Mercurial > public > algo-animator
diff src/algorithms.c @ 29:dae463bbf5ca
implementing multi-thread and refactoring
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Wed, 28 Jun 2023 20:10:55 +0100 |
parents | |
children | f945bcc3571f |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/algorithms.c Wed Jun 28 20:10:55 2023 +0100 @@ -0,0 +1,29 @@ +#include "algorithms.h" + + +void *bubble_sort(void *arguments) { + struct AlgoArgs *args = (struct AlgoArgs *)arguments; + + printf("Size: %i\n", args->arr_size); + printf("Comparisons: %i\n", args->comparisons); + (args->comparisons)++; + printf("Comparisons: %i\n", args->comparisons); + /* + for (int i = 0; i < args->arr_size - 1; i++) { + //(*args->comparisons)++; + + for (int j = 0; j < args->arr_size - i - 1; j++) { + //(*args->comparisons)++; + + if (args->arr[j].value > args->arr[j + 1].value) { + //swap_elements(j, j + 1, args->arr); + } + + + //usleep((*args->delay)); + //bool test = false; + //delay_flow(args->delay, &test); + } + } + */ +}