First atempt to binary sort

This commit is contained in:
Alexandre 2025-02-24 13:54:10 +01:00
parent 5dd345c9f4
commit cc95ca868f
4 changed files with 20 additions and 23 deletions

Binary file not shown.

View File

@ -1,21 +1,5 @@
# ninja log v6 # ninja log v6
1 9 1740394573852693968 CMakeFiles/Exercices.dir/Exercice2.c.o 8abbf7ed2ff63668 1 9 1740394573852693968 CMakeFiles/Exercices.dir/Exercice2.c.o 8abbf7ed2ff63668
14 23 1740399424068673015 Exercices f05032c4fac3334d
0 14 1740399424054672910 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
0 9 1740399723326817334 build.ninja 2e74603cecdb425f
0 14 1740399723328817343 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
14 23 1740399723342817403 Exercices 1155f81bcff01d1c
0 13 1740399750185932613 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
13 26 1740399750198932669 Exercices 1155f81bcff01d1c
1 14 1740399762272984410 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
14 22 1740399762285984465 Exercices 1155f81bcff01d1c
0 17 1740399869408438810 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
17 26 1740399869424438878 Exercices 1155f81bcff01d1c
0 14 1740399877033471575 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
14 23 1740399877047471635 Exercices 1155f81bcff01d1c
1 17 1740399893282541545 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
17 32 1740399893298541615 Exercices 1155f81bcff01d1c
0 14 1740399931349708754 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
14 22 1740399931363708815 Exercices 1155f81bcff01d1c
0 16 1740399978792913976 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
16 25 1740399978808914044 Exercices 1155f81bcff01d1c 16 25 1740399978808914044 Exercices 1155f81bcff01d1c
0 16 1740399978792913976 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
0 9 1740400419048998063 build.ninja 2e74603cecdb425f

View File

@ -1,3 +1,3 @@
Start testing: Feb 24 13:26 CET Start testing: Feb 24 13:33 CET
---------------------------------------------------------- ----------------------------------------------------------
End testing: Feb 24 13:26 CET End testing: Feb 24 13:33 CET

19
main.c
View File

@ -1,3 +1,5 @@
#include <iso646.h>
#include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -17,8 +19,19 @@ int *alloc_tab(){
return tab; return tab;
} }
void in_tab(int tab[], int cible) { bool dict_sort(int tab[], int cible) {
int occurence=0; // Définition et Assignation des variables
int pointer = 1;
int intervale= size;
int pivot;
bool trouve=false;
while (trouve==false and pointer<=intervale) {
pivot = (pointer+intervale)/2;
if (tab[pivot]>
}
for (int i=0; i < size; i++) { for (int i=0; i < size; i++) {
if (tab[i] == cible) { if (tab[i] == cible) {
printf("La cible se trouve dans le tableau\n"); printf("La cible se trouve dans le tableau\n");
@ -34,7 +47,7 @@ void in_tab(int tab[], int cible) {
} }
int main(void) { int main(void) {
int* tab=alloc_tab(); int* tab=alloc_tab();
in_tab(tab, 5); dict_sort(tab, 5);
free(tab); free(tab);
return 0; return 0;
} }