| 3 | #include<bits/stdc++.h> |
| 4 | using namespace std; |
| 5 | int main(){ |
| 6 | //sort() can be used to sort array or vector or a string. gcc_sort hybrid algorithm. O(NlogN) |
| 7 | |
| 8 | //int a[n]; sort(a,a+n); |
| 9 | |
| 10 | //vector<int>v; sort(v.begin(), v.end()); |
| 11 | |
| 12 | //string s; sort(s.begin(), s.end()); |
| 13 | |
| 14 | //sort(ptr to 1st element, ptr to last element+1) |
| 15 | int a[4]={5,4,1,2}; |
| 16 | //sort(a, a+3); output: 1 4 5 2 |
| 17 | |
| 18 | // sort(a, a+4); //output 1 2 4 5 |
| 19 | // for(int i=0; i<4; i++){ cout<<a[i]<<" ";} |
| 20 | |
| 21 | vector<int>v={5,4,1,2}; |
| 22 | sort(v.begin(), v.end()); |
| 23 | for(int i=0; i<4; i++){ cout<<v[i]<<" ";} |
| 24 | return 0; |
| 25 | } |
| 26 | ``` |
nothing calls this directly
no outgoing calls
no test coverage detected