In this problem, we say that a vector with integer numbers is bi-increasing if , , and there exists an index between and such that:
,
.
For instance, the vector is bi-increasing (with ).
Implement an efficient function
bool search(int x, const vector<int>& v);
such that, given an integer number and a bi-increasing vector , returns if is in or not. You can use and implement auxiliary functions if you need them.
The vector is bi-increasing.
You only need to submit the required procedure; your main program will be ignored.