STL provides binary search functions std::lower_bound and std::upper_bound, but I tend not to use them because I\'ve been unable to remember what they do, because their contract
For an array or vector :
std::lower_bound: Returns an iterator pointing to the first element in the range that is
std::upper_bound: Returns an iterator pointing to the first element in the range that is
less than value.(for array or vector in decreasing order)
greater than value.(for array or vector in increasing order)