MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/vector-concepts/vectorSort.cpp:5–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include<bits/stdc++.h>
4using namespace std;
5int 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)
15int 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
21vector<int>v={5,4,1,2};
22sort(v.begin(), v.end());
23for(int i=0; i<4; i++){ cout<<v[i]<<" ";}
24return 0;
25}
26```

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected