c++ comparator code example
Example 1: sort in descending order c++ stl
sort(arr, arr + n, greater())
Example 2: stl sort in c++
sort(arr, arr+n); // sorts in ascending order
sort(arr, arr + n, greater())
sort(arr, arr+n); // sorts in ascending order