-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
128 lines (100 loc) · 2.51 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include <ncurses.h>
#include <stdlib.h>
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <chrono>
#include "TimSort.h"
#include "ShellSort.h"
#include "HeapSort.h"
#include "QuickSort.h"
#include "StrandSort.h"
#include "PancakeSort.h"
#include "MergeSort.h"
#include "BubbleSort.h"
#include "InsertionSort.h"
#include "SelectionSort.h"
#include "Sorting.h"
int main(int argc, char *argv[]) {
std::vector<int> mess;
int messLength = 50;
std::vector<int> messLong;
int messLongLength = 10000;
for (int i = 0; i < messLength; ++i) {
mess.push_back(i + 1);
}
for (int i = 0; i < messLongLength; ++i) {
messLong.push_back(i + 1);
}
std::random_shuffle(mess.begin(), mess.end());
std::random_shuffle(messLong.begin(), messLong.end());
system("resize -s 50 150");
initscr();
raw();
noecho();
cbreak();
curs_set(0);
TimSort tmSort;
tmSort.setVect(mess);
clear();
tmSort.printSort();
mvprintw(0, 0, "%d ms -- TimSort", tmSort.getTime(messLong));
getch();
ShellSort shlSort;
shlSort.setVect(mess);
clear();
shlSort.printSort();
mvprintw(0, 0, "%d ms -- ShellSort", shlSort.getTime(messLong));
getch();
HeapSort hpSort;
hpSort.setVect(mess);
clear();
hpSort.printSort();
mvprintw(0, 0, "%d ms -- HeapSort", hpSort.getTime(messLong));
getch();
QuickSort qikSort;
qikSort.setVect(mess);
clear();
qikSort.printSort();
mvprintw(0, 0, "%d ms -- QuickSort", qikSort.getTime(messLong));
getch();
StrandSort stndSort;
stndSort.setVect(mess);
clear();
stndSort.printSort();
mvprintw(0, 0, "%d ms -- StrandSort", stndSort.getTime(messLong));
getch();
PancakeSort pnkSort;
pnkSort.setVect(mess);
clear();
pnkSort.printSort();
mvprintw(0, 0, "%d ms -- PancakeSort", pnkSort.getTime(messLong));
getch();
MergeSort mrgSort;
mrgSort.setVect(mess);
clear();
mrgSort.printSort();
mvprintw(0, 0, "%d ms -- MergeSort", mrgSort.getTime(messLong));
getch();
BubbleSort bblSort;
bblSort.setVect(mess);
clear();
bblSort.printSort();
mvprintw(0, 0, "%d ms -- BubbleSort", bblSort.getTime(messLong));
getch();
InsertionSort inrtSort;
inrtSort.setVect(mess);
clear();
inrtSort.printSort();
mvprintw(0, 0, "%d ms -- InsertionSort", inrtSort.getTime(messLong));
getch();
SelectionSort slctSort;
slctSort.setVect(mess);
clear();
slctSort.printSort();
mvprintw(0, 0, "%d ms -- SelectionSort", slctSort.getTime(messLong));
getch();
endwin();
return 0;
}