Do binary search,lower bound ,upper bound work for the data arranged in descending order?
and if works then what it returns?
Binary_search algorithm
@rutikesh_sawant
hello rutikesh,
For array sorted in non-increasing array, lower_bound() finds iterator to first element that does not compare greater than the given element. upper_bound() finds iterator to first element that is smaller than given element.
check this-> https://www.geeksforgeeks.org/upper_bound-and-lower_bound-for-non-increasing-vector-in-c/
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.