-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path33.cpp
More file actions
64 lines (44 loc) · 918 Bytes
/
Copy path33.cpp
File metadata and controls
64 lines (44 loc) · 918 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <bits/stdc++.h>
using namespace std;
// Inbuilt sort function of stl
int main() {
// input
// 6
// 4 5 2 25 7 8
// int n;
// cin>>n;
// int a[n];
// for (int i = 0; i < n; i++)
// {
// cin>>a[i];
// }
// // sort(a, a+n);
// // sort(a, a+2);
// sort(a+2, a+n);
// for (int i = 0; i < n; i++)
// {
// cout<<a[i]<<" ";
// }
/*
this sort function is called Introsort
this is mixture of three sort -
- quick sort
- heap sort
- insertion sort
complexity of this sort function is O(nlog(n))
*/
int n;
cin>>n;
vector<int> a(n);
for (int i = 0; i < n; i++)
{
cin>>a[i];
}
// sort(a.begin(), a.end());
sort(a.begin()+2, a.end());
for (int i = 0; i < n; i++)
{
cout<<a[i]<<" ";
}
return 0;
}