summaryrefslogtreecommitdiff
path: root/algo1w2
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-02-06 18:12:15 +0100
committerlonkaars <loek@pipeframe.xyz>2023-02-06 18:12:15 +0100
commitfeda98d7c7fc0771e3f143932d5184ab128dea92 (patch)
tree5552b70a67ae4a428e5856cb6b7576dc3c1394ad /algo1w2
parentd069d90980d9bf0af1f414c4f7584295dca50c44 (diff)
WIP algo week 2
Diffstat (limited to 'algo1w2')
-rw-r--r--algo1w2/main.c26
l---------algo1w2/makefile1
2 files changed, 27 insertions, 0 deletions
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 <stdio.h>
+
+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