(C++) Usage Questions for upper_bound

Asked 2 years ago, Updated 2 years ago, 27 views

Hi, how are you?

I'm studying upper_bound

I've only known how to use it like the first one below What exactly does the bottom mean?

V is a vector, but the beginning part is not defined, so can you explain it?

upper_bound(v.begin(),v.end(),value);

upper _bound(V,V+x,value);

c++

2022-09-22 12:30

1 Answers

v.begin() means the beginning of the vector v.end() means the end of the vector.

upper_bound (a, b, c) is the command to find the upperbound of the value c in the range a to b.

For example, upper_bound(v.begin(),v.end(),value); is to search from beginning to end of vector to find the upper bound of the value value.


2022-09-22 12:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.