I am begineer and I dont understand the following.
I got the output
Now my question is since the upper_bound()
operator gives the index of greater value how did the output gave the answer of upperbound as 7 and not 1.
Both the upper_bound
and lower_bound
functions require the range to be partitioned according to the value you are looking for, essentially being sorted. Since your vector does not meet this criterion, you cannot expect logical results.