Lower and upper bound

can we use lower and upper bound only in sorted array?

@varu hey lower bound and upper bound can be use on non sorted array or vector ,here is what they return:

Iterator lower_bound (Iterator first, Iterator last, const val)
Iterator upper_bound (Iterator first, Iterator last, const val)

lower_bound returns an iterator pointing to the first element in the range [first,last) which has a value not less than ‘val’.

upper_bound returns an iterator pointing to the first element in the range [first,last) which has a value greater than ‘val’.
Hope you get it :slight_smile: