-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
52 lines (41 loc) · 1.01 KB
/
main.cpp
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
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <iostream>
#include <string>
using namespace std;
#include "quicksort.h"
int main(int argc, char* argv[])
{
std::vector<std::string> v(10);
v[0]="Paris";
v[1]="London";
v[2]="Stockholm";
v[3]="Berlin";
v[4]="Oslo";
v[5]="Rome";
v[6]="Madrid";
v[7]="Tallinn";
v[8]="Amsterdam";
v[9]="Dublin";
std::cout<<"v before qsort: ";
std::for_each(v.begin(), v.end(), print<std::string>);
std::cout<<'\n';
quick_sort(v.begin(), v.end());
std::cout<<"v after qsort: ";
std::for_each(v.begin(), v.end(), print<std::string>);
std::cout<<'\n';
int a[]={3,8,0,6,7,4,2,1,9,3,1,8,3,9,2,0,9};
int *a_end=a+sizeof a/sizeof(int);
std::cout<<"a before qsort: ";
std::for_each(a, a_end, print<int>);
std::cout<<'\n';
quick_sort(a, a_end, pivot_random<int*>());
std::cout<<"a after qsort: ";
std::for_each(a, a_end, print<int>);
std::cout<<'\n';
return 0;
}