X1180: Recursive Is Increasing Vector C++

Write a recursive function called is_increasing that will receive a vector of integers called list and determine whether or not it is strictly in increasing order. That is, it should return true if each number in the vector is larger than its preceding number in the list. If the vector is empty or only has one number, it is also considered to be in increasing order.

For example, if list is originally {3,4,9,11,11,100}, it will return false because the second 11 is not larger than the first 11. However, if list is originally {100,500,515}, then it will return true since 515 is larger than 500, which is larger than 100.

HINT remember that you can add use pop_back() to remove items from the end of a vector, [] to access the value at an index of a vector, and size() to find the number of items in the vector. So list.pop_back(); would remove 515 if list had {100,500,515}, list[0] would get the value 100, and list.size(); would return the value 3.

Make sure to use recursion (no loops)!

Your Answer:

Reset

Practice a different C++ exercise

Feedback

Your feedback will appear here when you check your answer.