I have access cases, where numbers are increasing monotonically in the vector of an integer
< Pre> vec [0] = 2 vec [1] = 5 vec [2] = 8 vec [3] = 10.
If I am passing number 6 , Then I have to return the VC [1], because it is between Wake [1] and VCC [2], so 9 will have to be wake back. [2] My experience with STL is limited, so we Solve it with STL or you can Li bars may have to be repeated by storing each and when you hit more than the return number,
Four reusable binary search algorithms of STL & lt; Algorithm & gt; Header: ,,,, and.
Lower_bound
Actually you do not like: When the desired element does not exist in the sequence, then it returns an Iterator which refers to the element which is the last of the element One is want to have However, you should wrap it with code that applies to your behavior without much hassle.
Comments
Post a Comment