Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

bool isStrictlyIncreasing(const vector<int>& v)? Write a predicate function call

ID: 3552056 • Letter: B

Question

bool isStrictlyIncreasing(const vector<int>& v)?

Write a predicate function called isStrictlyIncreasing that checks whether a vector of integers contains values that are in strictly increasing order. A declaration of the function is shown above. The function returns true if the elements are in strictly increasing order? otherwise it returns false. For example, it will return true for v = (2,4, 5, 6,8) and it will return false for (3, 4, 6, 6, 9).
bool isStrictlyIncreasing(const vector<int>& v)?

Write a predicate function called isStrictlyIncreasing that checks whether a vector of integers contains values that are in strictly increasing order. A declaration of the function is shown above. The function returns true if the elements are in strictly increasing order? otherwise it returns false. For example, it will return true for v = (2,4, 5, 6,8) and it will return false for (3, 4, 6, 6, 9).
Write a predicate function called isStrictlyIncreasing that checks whether a vector of integers contains values that are in strictly increasing order. A declaration of the function is shown above. The function returns true if the elements are in strictly increasing order? otherwise it returns false. For example, it will return true for v = (2,4, 5, 6,8) and it will return false for (3, 4, 6, 6, 9).

Explanation / Answer

bool isStrictlyIncreasing(const vector<int>& v)

{

for(int i=1; i<v.size(); i++)

{

   if(v[i]<=v[i-1])

     return false;

}

return true;

}