0 | STL排序查找 | Edit | |||
STL sort
sort(arr+n1, arr+n2, sortMethod() );
struct sortMethod {
bool operator( const int & a1, const int & a2)
{
return a1 < a2;
}
}
STL search
binary_search(arr+n1, arr+n2, val, sortMethod);
T* lower_bound(arr+n1, arr+n2, val, sortMethod);
find from first to the last, arr[n] >= val
T* upper_bound
|