Mercurial > public > algo-animator
comparison src/main.c @ 52:468f82bd24ac
Update main.c
Added merge_sort as a choosable option
committer: GitHub <noreply@github.com>
author | Pietro Molendys <89810437+Pedritos22@users.noreply.github.com> |
---|---|
date | Wed, 02 Apr 2025 01:14:30 +0200 |
parents | 62b7c457510d |
children |
comparison
equal
deleted
inserted
replaced
51:8a9a7d020197 | 52:468f82bd24ac |
---|---|
7 int window_height = 1080; | 7 int window_height = 1080; |
8 int vpadding = 150; | 8 int vpadding = 150; |
9 int rect_width = 5; | 9 int rect_width = 5; |
10 int space = 1; | 10 int space = 1; |
11 | 11 |
12 struct Algo algos[4]; | 12 struct Algo algos[5]; |
13 int selected_algo = 0; | 13 int selected_algo = 0; |
14 int algos_size; | 14 int algos_size; |
15 | 15 |
16 struct AlgoArgs algo_args; | 16 struct AlgoArgs algo_args; |
17 struct ThreadState thread_state; | 17 struct ThreadState thread_state; |
309 strcpy(algos[2].name, "Quick sort"); | 309 strcpy(algos[2].name, "Quick sort"); |
310 algos[2].function = quick_sort; | 310 algos[2].function = quick_sort; |
311 | 311 |
312 strcpy(algos[3].name, "Insertion sort"); | 312 strcpy(algos[3].name, "Insertion sort"); |
313 algos[3].function = insertion_sort; | 313 algos[3].function = insertion_sort; |
314 | |
315 strcpy(algos[4].name, "Merge sort"); | |
316 algos[4].function = merge_sort; | |
314 | 317 |
315 algos_size = sizeof(algos) / sizeof(algos[0]); | 318 algos_size = sizeof(algos) / sizeof(algos[0]); |
316 | 319 |
317 create_array(algo_args.arr, algo_args.arr_size, window_height, vpadding); | 320 create_array(algo_args.arr, algo_args.arr_size, window_height, vpadding); |
318 randomize_array(algo_args.arr, algo_args.arr_size); | 321 randomize_array(algo_args.arr, algo_args.arr_size); |