Tri par insertion
This commit is contained in:
parent
3105d75565
commit
afa14222fa
Binary file not shown.
@ -10,3 +10,27 @@
|
||||
15 23 1740403873708161538 Exercices 1155f81bcff01d1c
|
||||
0 15 1740403932701569894 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
15 24 1740403932716569998 Exercices 1155f81bcff01d1c
|
||||
1 15 1740404429522008915 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
15 23 1740404429536009012 Exercices 1155f81bcff01d1c
|
||||
0 14 1740404434608044121 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
14 23 1740404434622044217 Exercices 1155f81bcff01d1c
|
||||
1 14 1740404445731121115 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
14 23 1740404445744121205 Exercices 1155f81bcff01d1c
|
||||
0 21 1740404452639168933 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
21 30 1740404452660169078 Exercices 1155f81bcff01d1c
|
||||
0 15 1740404929887310942 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
15 23 1740404929902311036 Exercices 1155f81bcff01d1c
|
||||
0 14 1740404945020405949 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
14 22 1740404945034406037 Exercices 1155f81bcff01d1c
|
||||
1 16 1740405250012320715 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
16 32 1740405250027320809 Exercices 1155f81bcff01d1c
|
||||
0 38 1740473535628230610 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
38 57 1740473535666230461 Exercices 1155f81bcff01d1c
|
||||
0 18 1740473558635746608 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
18 26 1740473558653749514 Exercices 1155f81bcff01d1c
|
||||
0 15 1740473607792717837 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
15 24 1740473607807717938 Exercices 1155f81bcff01d1c
|
||||
1 15 1740473619845938424 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
15 24 1740473619860938858 Exercices 1155f81bcff01d1c
|
||||
0 17 1740473682139410407 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
|
||||
17 25 1740473682155410510 Exercices 1155f81bcff01d1c
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
Start testing: Feb 24 14:32 CET
|
||||
Start testing: Feb 25 09:54 CET
|
||||
----------------------------------------------------------
|
||||
End testing: Feb 24 14:32 CET
|
||||
End testing: Feb 25 09:54 CET
|
||||
|
||||
31
main.c
31
main.c
@ -49,9 +49,36 @@ bool dict_sort(int tab[], int cible) {
|
||||
}
|
||||
return trouve;
|
||||
}
|
||||
|
||||
void insert(int tab[], int position, int element) {
|
||||
int i = position;
|
||||
while (i>0 && tab[i]>element) {
|
||||
tab[i+1]=tab[i];
|
||||
i=i-1;
|
||||
}
|
||||
tab[i+1]=element;
|
||||
}
|
||||
|
||||
void sortinsert(int tab[]) {
|
||||
int i;
|
||||
for (i=2; i<=size; i++) {
|
||||
insert(tab, i-1, tab[i]);
|
||||
}
|
||||
}
|
||||
|
||||
int permutation(int tab[], int premier, int deuxieme) {
|
||||
int temp;
|
||||
|
||||
temp=tab[premier];
|
||||
tab[premier]=tab[deuxieme];
|
||||
tab[deuxieme]=temp;
|
||||
printf("%d ",tab);
|
||||
return tab;
|
||||
}
|
||||
int main(void) {
|
||||
int* tab=alloc_tab();
|
||||
dict_sort(tab, 5);
|
||||
//dict_sort(tab, 5);
|
||||
sortinsert(tab);
|
||||
free(tab);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user