Algorithms
/* Example: sorting vector v */
std::sort(v.begin(), v.end());
- lower_bound given a sorted vector and a search value
std::lower_bound(int start, int end, Type value)
- if the value exisit, return the position of the value
- if doesn't exist, return the position of the smallest element greater than the search value
/* Example: find the position of lower bound
of val, in vector v */
vector<int>::iterator low = lower_bound(v.begin(), v.end(), val);
/* The index of lower bound element is: */
cout << low - v.begin() << endl;