-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
72 lines (59 loc) · 2.83 KB
/
Copy pathmain.cpp
File metadata and controls
72 lines (59 loc) · 2.83 KB
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
// TÁC GIẢ: TRƯỜNG CHINH (NTC++)
// GITHUB: GITHUB.COM/TRGCHINHH
// CHƯƠNG TRÌNH ĐO THỜI GIAN CHẠY CỦA 18 THUẬT TOÁN SẮP XẾP NỔI TIẾNG HIỆN NAY TRONG C++
// _____ ____ _____ _______ _ _____ ____ _____ _____ _______ _ _ __ __
// / ____|/ __ \| __ \__ __| /\ | | / ____|/ __ \| __ \|_ _|__ __| | | | \/ |
// | (___ | | | | |__) | | | / \ | | | | __| | | | |__) | | | | | | |__| | \ / |
// \___ \| | | | _ / | | / /\ \ | | | | |_ | | | | _ / | | | | | __ | |\/| |
// ____) | |__| | | \ \ | | / ____ \| |___| |__| | |__| | | \ \ _| |_ | | | | | | | | |
// |_____/ \____/|_| \_\ |_| /_/ \_\______\_____|\____/|_| \_\_____| |_| |_| |_|_| |_|
// MIT LICENSE 2026
#include "include.h"
int main(){
vector<int> a(RANDOM_SIZE);
vector<int> cnt(RANDOM_SIZE, 0);
print_banner(BANNER);
enter_random_size(RANDOM_SIZE, a, cnt);
while(1){
print_banner(BANNER);
cout << " [+] Random size: " << RANDOM_SIZE << "\n\n";
print_menu();
c_srand();
random_vector_and_cnt(a, cnt);
cout << "\n [?] Enter option: ";
int choice; cin >> choice;
datetime start_time = timenow();
if(choice == 0){
enter_random_size(RANDOM_SIZE, a, cnt);
continue;
}
else if(choice == 1) bubble_sort(a);
else if(choice == 2) selection_sort(a);
else if(choice == 3) insertion_sort(a);
else if(choice == 4) binary_insertion_sort(a);
else if(choice == 5) shaker_sort(a);
else if(choice == 6) shell_sort(a);
else if(choice == 7) quick_sort(a, 0, a.size() - 1);
else if(choice == 8) merge_sort(a, 0, a.size() - 1);
else if(choice == 9) heap_sort(a);
else if(choice == 10) counting_sort(a, cnt);
else if(choice == 11) radix_sort(a);
else if(choice == 12) bucket_sort(a);
else if(choice == 13) flash_sort(a);
else if(choice == 14) tim_sort(a);
else if(choice == 15) intro_sort(a);
else if(choice == 16) comb_sort(a);
else if(choice == 17) gnome_sort(a);
else if(choice == 18) tree_sort(a);
else if(choice == 19) {
cout << " Goodbye !" << endl;
exit(0);
}
else cout << " Invalid option !" << endl;
datetime end_time = timenow();
cout << endl << " Sort completed" << endl;
print_timedelta(start_time, end_time);
print_vector(a);
pause_program();
}
}