From 4e34aa3aa6a1c76decae2353754fa78fa6fa3c38 Mon Sep 17 00:00:00 2001 From: Aubert Date: Mon, 15 Sep 2025 14:27:14 +0200 Subject: [PATCH] hahah --- bubblesort.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++-- short.c | 4 ++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/bubblesort.c b/bubblesort.c index 2fb0d04..0dffd4d 100644 --- a/bubblesort.c +++ b/bubblesort.c @@ -1,8 +1,7 @@ // Bubblesort Algorithm // M.Menault 2024 -void bubblesort(int* array, int length) -{ +void bubblesort(int* array, int length){ int swapped, i, tmp; do { @@ -23,3 +22,59 @@ void bubblesort(int* array, int length) + + + +int swapped, i, tmp; + do + { + swapped = 0; + for(i=1;i array[i]) + { + tmp = array[i-1]; + array[i-1] = array[i]; + array[i] = tmp; + swapped++; + } + } + } while(swapped==1); +} + + + int * test = (int*) malloc(length*sizeof(int)); + int max = -1; + for (j=1;jmax){ + indice = i ; + max =array[i]; + } + } + test[indice]=max; + array[indice]=-1; + } + for (j=1;j array[i]) + { + tmp = array[i-1]; + array[i-1] = array[i]; + array[i] = tmp; + swapped++; + } + } + } while(swapped==1) +} + diff --git a/short.c b/short.c index e69de29..9093717 100644 --- a/short.c +++ b/short.c @@ -0,0 +1,4 @@ +#include +#include + +