From feda98d7c7fc0771e3f143932d5184ab128dea92 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Mon, 6 Feb 2023 18:12:15 +0100 Subject: WIP algo week 2 --- algo1w2/main.c | 26 ++++++++++++++++++++++++++ algo1w2/makefile | 1 + 2 files changed, 27 insertions(+) create mode 100644 algo1w2/main.c create mode 120000 algo1w2/makefile (limited to 'algo1w2') diff --git a/algo1w2/main.c b/algo1w2/main.c new file mode 100644 index 0000000..4bc6c46 --- /dev/null +++ b/algo1w2/main.c @@ -0,0 +1,26 @@ +#include + +void bubble_sort(int* arr, unsigned size) { + int outer, inner; + bool sorted = false; +} + +void print_arr(int* arr, unsigned size) { + printf("["); + for (unsigned i = 0; i < size; i++) { + if (i > 0) printf(", "); + printf("%d", arr[i]); + } + printf("]\n"); +} + +int main() { + int arr[] = { 7, 3, 8, 1, 2, 5, 4, 6, 9, 0 }; + unsigned size = sizeof(arr) / sizeof(int); + + print_arr(arr, size); + bubble_sort(arr, size); + print_arr(arr, size); + + return 0; +} diff --git a/algo1w2/makefile b/algo1w2/makefile new file mode 120000 index 0000000..a4e84c6 --- /dev/null +++ b/algo1w2/makefile @@ -0,0 +1 @@ +../week.mk \ No newline at end of file -- cgit v1.2.3