-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (26 loc) · 813 Bytes
/
Copy pathmain.cpp
File metadata and controls
34 lines (26 loc) · 813 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
#include "src/sorts/sorts_list.h"
using namespace sorts;
int main() {
auto ait = ArrayInTerminal();
ait.full_rec_draw(true);
int n1=ait.w(), arr1[n1];
SortsVis::init_array(arr1, n1);
// Cool sorting algorithms O(n*log(n))
MergeSort{&ait}.run(arr1, n1, 0);
QuickSort{&ait}.run(arr1, n1, 0);
HeapSort{&ait}.run(arr1, n1, 0);
RadixSort{&ait}.run(arr1, n1, 5);
// Poor sorting algorithms O(n^2)
int n2=ait.w()/3, arr2[n2];
SortsVis::init_array(arr2, n2);
InsertionSort{&ait}.run(arr2, n2, 10);
CocktailSort{&ait}.run(arr2, n2, 0);
SelectionSort{&ait}.run(arr2, n2, 100);
BubbleSort{&ait}.run(arr2, n2, 0);
// Stupid sort O(n*n!)
auto t = BogoSort{&ait};
t.set_size_window(46, 49);
t.rand_run(7, 0);
getchar();
return 0;
}