c++ sort algorithm code example
Example 1: stl sort in c++
sort(arr, arr+n); // sorts in ascending order
Example 2: sort c++
sort(arr, arr+length); //increase
sort(arr, arr+length, greater<int>()); //decrease
Example 3: c++ sort
int arr[]= {2,3,5,6,1,2,3,6,10,100,200,0,-10};
int n = sizeof(arr)/sizeof(int);
sort(arr,arr+n);
for(int i: arr)
{
cout << i << " ";
}