does upper bound and lower bound only works for sorted array?
and what if all the elements of an array are lesser then key then what will lower bound return?
Upper and lower bound
@pradhumangupta99 yes the array should be sorted.
If no key satisfies the value then a pointer to the hypothetical last element is returned.
for eg in array, arr+n shall be returned, in a vector or string, v.end( ) shall be returned.
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.