diff --git a/Projet/Graphe_general.png b/Projet/Graphe_general.png new file mode 100644 index 0000000000000000000000000000000000000000..96da04403435fea03749d82e9f2e3ba51a7509a0 Binary files /dev/null and b/Projet/Graphe_general.png differ diff --git a/Projet/test.sh b/Projet/test.sh index 027e8ba3efde7d1522c79da0626662c3b091cfd8..3ee9fa16915a7aa77f1e382c61ac9265178f831b 100644 --- a/Projet/test.sh +++ b/Projet/test.sh @@ -3,7 +3,7 @@ affichage=0 #taille=100 -echo -e "iTest\ttaille\ttemps\tmem\talgo\ttypeTableau" +echo -e "iTest\ttaille\ttemps\tmem\talgo\t" for iTest in `seq 1 10` do diff --git a/TP2/tri_cocktail.c b/TP2/tri_cocktail.c new file mode 100644 index 0000000000000000000000000000000000000000..5622f08a1ec6854750436a0f34d53b8fd6249e80 --- /dev/null +++ b/TP2/tri_cocktail.c @@ -0,0 +1,24 @@ +#include <math.h> +#include <stdlib.h> +#include <stdio.h> +#include "tri_cocktail.h" + +void triCocktail(long* A, size_t n){ + size_t permutation; + size_t en_cours=0, sens=1; + size_t debut=1, fin=n-1; + do{ + permutation =0; + while(((sens==1)&& (en_cour<fin)) || ((sens==-1)&&(en_cours>debut))){ + en_cour += sens; + if(A[en_cours]<A[encours-1]){ + long temp = A[en_cours]; + A[en_cours]=A[encours-1]; + A[en_cours-1]= temp; + permutation = 1; + } + } + if(sens==1) fin--; else debut ++; + sens = -sens; + }while(permutation = 1); +} \ No newline at end of file diff --git a/TP2/tri_cocktail.h b/TP2/tri_cocktail.h new file mode 100644 index 0000000000000000000000000000000000000000..0d4a2dce077c414d1c8aa04487f18c0e1a3ab66b --- /dev/null +++ b/TP2/tri_cocktail.h @@ -0,0 +1,7 @@ +#ifndef TRIS_I +#define TRIS_I +#include <stdint.h> +#include <stdlib.h> + +void triCocktail(long* A, size_t n); +#endif //TRIS_C \ No newline at end of file