diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000000000000000000000000000000000000..0f06797c840400ab1e6cf56e1ad97bdd701cfe39
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,5 @@
+{
+    "files.associations": {
+        "stdio.h": "c"
+    }
+}
\ No newline at end of file
diff --git a/README.md b/README.md
index 4a51454c37a9fed7ca4e46f953349f8f23a41449..9c3c7ec0b5aecdd7feb9ce45cbd01e816a259b73 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,8 @@
 [Grille d'évaluation P4z](https://docs.google.com/spreadsheets/d/1VXeO91rhy04xa0p8KUhWliFl228utHaDir8MstO5Z-M/edit?usp=sharing
 )
 
+![plot](/TP2/testInsertion.png)
+
 ## Problème
 
 Description du Problème.
diff --git a/TP1/main b/TP1/main
index d1487facee325fdb0d5f18151a49b23445190c91..e1c2a656341bd0b46333d87f12c91f9830e88306 100755
Binary files a/TP1/main and b/TP1/main differ
diff --git a/TP1/main.c b/TP1/main.c
index 8b03e2fec88d3284aa059b6a394b596c31f87f1e..902db23af3a0915aa8a9c523c5ca388fdef0ff93 100644
--- a/TP1/main.c
+++ b/TP1/main.c
@@ -6,22 +6,22 @@
 
 int main() {
   printf("Tri Insertion: \n");
-  long triIns[8] ={3,2,8,4,1,6,7,5};
-  affichertab(triIns,8);
-  triInsertion(triIns,8);
-  affichertab(triIns,8);
+  long* triIns = listeAlea(100,300);
+  affichertab(triIns,100);
+  triInsertion(triIns,100);
+  affichertab(triIns,100);
 
   printf("Tri Rapide: \n");
-  long triRap[8] ={3,2,8,4,1,6,7,5};
-  affichertab(triRap,8);
-  triRapide(triRap, 8);
-  affichertab(triRap,8);
+  long* triRap = listeAlea(100,300);
+  affichertab(triRap,100);
+  triRapide(triRap, 100);
+  affichertab(triRap,100);
 
   printf("Tri Fusion: \n");
-  long triFus[8] ={3,2,8,4,1,6,7,5};
-  affichertab(triFus,8);
-  triFusion(triFus, 8);
-  affichertab(triFus,8);
+  long* triFus = listeAlea(100,300);
+  affichertab(triFus,100);
+  triFusion(triFus, 100);
+  affichertab(triFus,100);
 
   return 0;
 }
diff --git a/TP1/tridec.c b/TP1/tridec.c
new file mode 100644
index 0000000000000000000000000000000000000000..96fab4edd959729e0da0317f02e9a47a7b6b4663
--- /dev/null
+++ b/TP1/tridec.c
@@ -0,0 +1,108 @@
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "tris.h"
+
+void triInsertionDec(long* A, size_t n) {
+    for(size_t i = 1; i <= n-1; i++){
+        long cle = A[i];
+        size_t j = i - 1;
+        size_t ecriture=0;
+        while(j+1 >= j && A[j] > cle){
+            ecriture++;
+            A[j+1] = A[j];
+            j = j-1;
+        }
+        ecriture++;
+        A[j+1] = cle;
+    }
+}
+
+void triFusionDec(long* A, size_t size) {
+  sousTriFusionDec(A, 0, size);
+}
+
+void sousTriFusionDec(long* A, size_t first, size_t size) {
+    if(first+1 <size){ // p < r - 1
+        size_t middle = floor((first+size)/2);
+        sousTriFusionDec(A, first, middle);
+        sousTriFusionDec(A, middle, size);
+        fusionDec(A, first, middle, size);
+    }
+}
+
+void copySousTableDec(long* mainT, long* underT, size_t id, size_t size) {
+  for(size_t i = id; i < id+size; ++i) {
+    underT[i-id] = mainT[i];
+  }
+}
+
+void fusionDec(long* A, size_t first, size_t middle, size_t size) {
+    size_t n1 = middle - first; // Nb elem dans A[p , q]  q exclu
+    size_t n2 = size - middle;  // Nb elem dans A[q , r]  r exclu
+
+    size_t indg = 0;
+    size_t indd = 0;
+
+    long* ag = malloc(sizeof(long) * n1);
+    long* ad = malloc(sizeof(long) * n2);
+
+    copySousTableDec(A, ag, first, n1);
+    copySousTableDec(A, ad, middle, n2);
+
+    int i = first;
+
+    while(i < size) {
+      if(indg == n1) {
+        A[i] = ad[indd];
+        indd++;
+      }
+      else if(indd == n2) {
+        A[i] = ag[indg];
+        indg++;
+      }
+      else if(ag[indg] < ad[indd]) {
+        A[i] = ag[indg];
+        indg++;
+      }
+      else {
+        A[i] = ad[indd];
+        indd++;
+      }
+      ++i;
+    }
+
+    free(ag);
+    free(ad);
+}
+
+void triRapideDec(long* A, size_t n) {
+    sousTriRapideDec(A,0,n);
+}
+
+void sousTriRapideDec(long* A, size_t first, size_t size){
+    if(first+1 < size){
+        size_t middle = partitionDec(A,first,size);
+        sousTriRapideDec(A,first,middle);
+        sousTriRapideDec(A,middle+1,size);
+    }
+}
+
+size_t partitionDec(long* A, size_t first, size_t size) {
+    long pivot = A[size-1];
+    size_t i = first;
+    for(int j = first; j+2 <= size; j++){
+        if(A[j] <= pivot){
+            permuterDec(A,i,j);
+            i++;
+        }
+    }
+    permuterDec(A,i,size-1);
+    return i;
+}
+
+void permuterDec(long* A,size_t i,size_t j) {
+    long inter = A[i];
+    A[i] = A[j];
+    A[j] = inter;
+}
diff --git a/TP1/tridec.h b/TP1/tridec.h
new file mode 100644
index 0000000000000000000000000000000000000000..6b4dbf8aa7ae075c9115fca0a73588967c9c7dde
--- /dev/null
+++ b/TP1/tridec.h
@@ -0,0 +1,17 @@
+#ifndef TRIS_H
+#define TRIS_H
+#include <stdint.h>
+#include <stdlib.h>
+
+void triInsertionDec(long* A, size_t n);
+
+void triFusionDec(long* A, size_t size);
+void sousTriFusionDec(long* A, size_t first, size_t size);
+void fusionDec(long* A, size_t first, size_t middle, size_t size);
+
+void triRapideDec(long* A, size_t n);
+void sousTriRapideDec(long* A, size_t first, size_t size);
+size_t partitionDec(long* A, size_t first, size_t size);
+void permuterDec(long* A,size_t i,size_t j);
+
+#endif //TRIS_H
\ No newline at end of file
diff --git a/TP1/tris.o b/TP1/tris.o
index a60fc51aa905726e26b581fcbdde9c80d5f4adfe..3efd234b62b12a752cf80fdb172ff874b2259a64 100644
Binary files a/TP1/tris.o and b/TP1/tris.o differ
diff --git a/TP1/utils.c b/TP1/utils.c
index be9137a01d4d17a98d52ffb97a0045de94f44ea9..3715ef2ad44103addcb5ba36954139273f0944c5 100644
--- a/TP1/utils.c
+++ b/TP1/utils.c
@@ -9,3 +9,11 @@ void affichertab(long* T, int s){
     }
     printf("%d ]\n",T[s-1]);
 }
+
+long* listeAlea(size_t longeur, size_t N){
+    long liste[longeur];
+    for(size_t i = 0; i < longeur; i++){
+        liste[i] = rand() % N; 
+    }
+    return liste;  
+} 
\ No newline at end of file
diff --git a/TP1/utils.h b/TP1/utils.h
index 9bc1d220ac2380c3a1096bf8c7205dcd3e8bc196..d36682b4fd5b01fcae7507a775a26abb9a5cc227 100644
--- a/TP1/utils.h
+++ b/TP1/utils.h
@@ -1,4 +1,5 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-void affichertab(long* T, int s);
\ No newline at end of file
+void affichertab(long* T, int s);
+long* listeAlea(size_t longeur, size_t N);
\ No newline at end of file
diff --git a/TP1/utils.o b/TP1/utils.o
index 4ff1808805cf14b0b2307154829db41bcb7d719c..1efc08401d93d50fd87c0b5a4cc61da2ae97ead8 100644
Binary files a/TP1/utils.o and b/TP1/utils.o differ
diff --git a/TP2/Makefile b/TP2/Makefile
index 4ef68c03f7953ab2723c38e05c9466be1a6040f7..01fc0ab4bd50ae5aa31829a3485ab9086a14f8fe 100644
--- a/TP2/Makefile
+++ b/TP2/Makefile
@@ -1,12 +1,18 @@
 all: main
-	
-main : tris.o utils.o main.c
-	gcc -o main -Wall utils.o tris.o -g main.c
 
-tris.o : tris.c tris.h
-	gcc -c -Wall -g tris.c
+main : tri_fusion.o tri_insertion.o tri_rapide.o utils.o main.c
+	gcc -o main -Wall utils.o tri_fusion.o tri_insertion.o tri_rapide.o -g main.c
+
+tri_fusion.o : tri_fusion.c tri_fusion.h
+	gcc -c -Wall -g tri_fusion.c
+
+tri_insertion.o : tri_insertion.c tri_insertion.h
+	gcc -c -Wall -g tri_insertion.c
+
+tri_rapide.o : tri_rapide.c tri_rapide.h
+	gcc -c -Wall -g tri_rapide.c
 
 utils.o : utils.c utils.h
-	gcc -o utils.o -c -g utils.c
+	gcc -c -g utils.c
 clean :
 	rm *.o
diff --git a/TP2/Rplots.pdf b/TP2/Rplots.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..efaf63a1895b8b5623783c397cda2bc0d509118b
Binary files /dev/null and b/TP2/Rplots.pdf differ
diff --git a/TP2/main b/TP2/main
index 4bcea08537181edf148e3c95d4cc01c68c08e7ef..0391e232b899ed6e4727ed693515e67986eb03a2 100755
Binary files a/TP2/main and b/TP2/main differ
diff --git a/TP2/main.c b/TP2/main.c
index c9c57bbff3d58a7349d03e767b597041fa090772..625a32087c881feb0f778c03685bf9b4539e0ee9 100644
--- a/TP2/main.c
+++ b/TP2/main.c
@@ -1,6 +1,9 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include "tris.h"
+#include "tri_insertion.h"
+#include "tri_rapide.h"
+#include "tri_fusion.h"
+
 #include "utils.h"
 
 int main(int argc, char *argv[]) {
@@ -19,27 +22,32 @@ int main(int argc, char *argv[]) {
 
   switch(typeAlgo) {
     case 'i':
-      printf("Tri Insertion: \n");
       triInsertion(tab,taille);
 
-      if(afficher)
+      if(afficher) {
+        printf("Tri Insertion: \n");
         affichertab(tab,taille);
+      }
+
       break;
 
     case 'r':
-      printf("Tri Rapide: \n");
       triRapide(tab, taille);
 
-      if(afficher)
+      if(afficher) {
+        printf("Tri Rapide: \n");
         affichertab(tab,taille);
+      }
+
       break;
 
     case 'f':
-      printf("Tri Fusion: \n");
       triFusion(tab, taille);
 
-      if(afficher)
+      if(afficher) {
+        printf("Tri Fusion: \n");
         affichertab(tab,taille);
+      }
       break;
   }
 
diff --git a/TP2/test.R b/TP2/test.R
new file mode 100644
index 0000000000000000000000000000000000000000..0fd0cc4c56944d4043d735fd0991ac84f86da60c
--- /dev/null
+++ b/TP2/test.R
@@ -0,0 +1,7 @@
+library(ggplot2)
+perf <- read.table("test.dat", header = TRUE)
+ggplot(perf, aes(x=taille, y=temps)) +
+geom_point() + geom_smooth() +
+ ggtitle("Graphe Tri insertion")
+
+ggsave("testInsertion.png")
diff --git a/TP2/test.dat b/TP2/test.dat
new file mode 100644
index 0000000000000000000000000000000000000000..4c62768fe7020a880f18e67e0f584ea146ea7327
--- /dev/null
+++ b/TP2/test.dat
@@ -0,0 +1,11 @@
+iTest	taille	temps	mem
+1	55732	1.88	1712
+2	27314	0.45	1404
+3	87676	4.60	1992
+4	75537	3.49	1784
+5	34190	0.72	1576
+6	4798	0.01	1284
+7	38426	0.90	1584
+8	62769	2.38	1680
+9	75789	3.42	1844
+10	45402	1.23	1608
diff --git a/TP2/test.sh b/TP2/test.sh
index 6fbf71901ae77d35b32825602caeef21f16f165c..0422f48fce4eb9ade9c9facad3afaa16445b5613 100644
--- a/TP2/test.sh
+++ b/TP2/test.sh
@@ -1,10 +1,14 @@
 #!/bin/bash
 
-algo = "insertion"
-taille = 10000
+algo="insertion"
+affichage=0
+#taille=100
 
-for iTest in 'seq 1 100'
+echo -e "iTest\ttaille\ttemps\tmem"
+
+for iTest in `seq 1 10`
 do
-    res = (/usr/bin/time -f "%U\t%M" ./main $algo $taille)
+    taille=$(( `od -An -N4 -tu < /dev/urandom` % 100000))
+    res=`( /usr/bin/time -f "%U\t%M" ./main $algo $taille $affichage > /dev/null ) 2>&1`
     echo -e "$iTest\t$taille\t$res"
 done
diff --git a/TP2/testInsertion.png b/TP2/testInsertion.png
new file mode 100644
index 0000000000000000000000000000000000000000..647bb543964adf530a72fd75ca4b6537c48e772d
Binary files /dev/null and b/TP2/testInsertion.png differ
diff --git a/TP2/tris.c b/TP2/tri_fusion.c
similarity index 58%
rename from TP2/tris.c
rename to TP2/tri_fusion.c
index d3df80cbcad7dabaddc3cb3300a1f62e1b07dd95..7453f701675217f5c498af12770c5557160a4909 100644
--- a/TP2/tris.c
+++ b/TP2/tri_fusion.c
@@ -1,19 +1,7 @@
 #include <math.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "tris.h"
-
-void triInsertion(long* A, size_t n) {
-    for(size_t i = 1; i <= n-1; i++){
-        long cle = A[i];
-        size_t j = i - 1;
-        while(j+1 >= j && A[j] > cle){
-            A[j+1] = A[j];
-            j = j-1;
-        }
-        A[j+1] = cle;
-    }
-}
+#include "tri_fusion.h"
 
 void triFusion(long* A, size_t size) {
   sousTriFusion(A, 0, size);
@@ -71,35 +59,4 @@ void fusion(long* A, size_t first, size_t middle, size_t size) {
 
     free(ag);
     free(ad);
-}
-
-void triRapide(long* A, size_t n) {
-    sousTriRapide(A,0,n);
-}
-
-void sousTriRapide(long* A, size_t first, size_t size){
-    if(first+1 < size){
-        size_t middle = partition(A,first,size);
-        sousTriRapide(A,first,middle);
-        sousTriRapide(A,middle+1,size);
-    }
-}
-
-size_t partition(long* A, size_t first, size_t size) {
-    long pivot = A[size-1];
-    size_t i = first;
-    for(int j = first; j+2 <= size; j++){
-        if(A[j] <= pivot){
-            permuter(A,i,j);
-            i++;
-        }
-    }
-    permuter(A,i,size-1);
-    return i;
-}
-
-void permuter(long* A,size_t i,size_t j) {
-    long inter = A[i];
-    A[i] = A[j];
-    A[j] = inter;
-}
+}
\ No newline at end of file
diff --git a/TP2/tri_fusion.h b/TP2/tri_fusion.h
new file mode 100644
index 0000000000000000000000000000000000000000..093102cb4f5b15f86b7c7905363bd1f945d04424
--- /dev/null
+++ b/TP2/tri_fusion.h
@@ -0,0 +1,9 @@
+#ifndef TRIS_F
+#define TRIS_F
+#include <stdint.h>
+#include <stdlib.h>
+
+void triFusion(long* A, size_t size);
+void sousTriFusion(long* A, size_t first, size_t size);
+void fusion(long* A, size_t first, size_t middle, size_t size);
+#endif //TRIS_H
\ No newline at end of file
diff --git a/TP2/tri_fusion.o b/TP2/tri_fusion.o
new file mode 100644
index 0000000000000000000000000000000000000000..eb045e9b24054cc7ff4449762c198a5670c22e21
Binary files /dev/null and b/TP2/tri_fusion.o differ
diff --git a/TP2/tri_insertion.c b/TP2/tri_insertion.c
new file mode 100644
index 0000000000000000000000000000000000000000..b276ebd2d589e398fbd838f129fc3a6207dbef76
--- /dev/null
+++ b/TP2/tri_insertion.c
@@ -0,0 +1,16 @@
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "tri_insertion.h"
+
+void triInsertion(long* A, size_t n) {
+    for(size_t i = 1; i <= n-1; i++){
+        long cle = A[i];
+        size_t j = i - 1;
+        while(j+1 >= j && A[j] > cle){
+            A[j+1] = A[j];
+            j = j-1;
+        }
+        A[j+1] = cle;
+    }
+}
\ No newline at end of file
diff --git a/TP2/tri_insertion.h b/TP2/tri_insertion.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e92151e6896f0e4c74d4986d79d20bae9595fba
--- /dev/null
+++ b/TP2/tri_insertion.h
@@ -0,0 +1,7 @@
+#ifndef TRIS_I
+#define TRIS_I
+#include <stdint.h>
+#include <stdlib.h>
+
+void triInsertion(long* A, size_t n);
+#endif //TRIS_H
\ No newline at end of file
diff --git a/TP2/tri_insertion.o b/TP2/tri_insertion.o
new file mode 100644
index 0000000000000000000000000000000000000000..9724cd3ec7610251d4ad9876b4815e2de665579c
Binary files /dev/null and b/TP2/tri_insertion.o differ
diff --git a/TP2/tri_rapide.c b/TP2/tri_rapide.c
new file mode 100644
index 0000000000000000000000000000000000000000..41eaa3b77e77dd30d53a041ca5f88490cf06a16d
--- /dev/null
+++ b/TP2/tri_rapide.c
@@ -0,0 +1,36 @@
+#include <math.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "tri_rapide.h"
+
+
+void triRapide(long* A, size_t n) {
+    sousTriRapide(A,0,n);
+}
+
+void sousTriRapide(long* A, size_t first, size_t size){
+    if(first+1 < size){
+        size_t middle = partition(A,first,size);
+        sousTriRapide(A,first,middle);
+        sousTriRapide(A,middle+1,size);
+    }
+}
+
+size_t partition(long* A, size_t first, size_t size) {
+    long pivot = A[size-1];
+    size_t i = first;
+    for(int j = first; j+2 <= size; j++){
+        if(A[j] <= pivot){
+            permuter(A,i,j);
+            i++;
+        }
+    }
+    permuter(A,i,size-1);
+    return i;
+}
+
+void permuter(long* A,size_t i,size_t j) {
+    long inter = A[i];
+    A[i] = A[j];
+    A[j] = inter;
+}
diff --git a/TP2/tri_rapide.h b/TP2/tri_rapide.h
new file mode 100644
index 0000000000000000000000000000000000000000..e17099f3db77cc6284f5e220d7f930886672a500
--- /dev/null
+++ b/TP2/tri_rapide.h
@@ -0,0 +1,10 @@
+#ifndef TRIS_R
+#define TRIS_R
+#include <stdint.h>
+#include <stdlib.h>
+
+void triRapide(long* A, size_t n);
+void sousTriRapide(long* A, size_t first, size_t size);
+size_t partition(long* A, size_t first, size_t size);
+void permuter(long* A,size_t i,size_t j);
+#endif //TRIS_H
\ No newline at end of file
diff --git a/TP2/tri_rapide.o b/TP2/tri_rapide.o
new file mode 100644
index 0000000000000000000000000000000000000000..8607958dfc01247a62387a91f7451aa057b1a25d
Binary files /dev/null and b/TP2/tri_rapide.o differ
diff --git a/TP2/tris.h b/TP2/tris.h
deleted file mode 100644
index 9841ffb6e67d3ae291493953eb6087b81d284159..0000000000000000000000000000000000000000
--- a/TP2/tris.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef TRIS_H
-#define TRIS_H
-#include <stdint.h>
-#include <stdlib.h>
-
-void triInsertion(long* A, size_t n);
-
-void triFusion(long* A, size_t size);
-void sousTriFusion(long* A, size_t first, size_t size);
-void fusion(long* A, size_t first, size_t middle, size_t size);
-
-void triRapide(long* A, size_t n);
-void sousTriRapide(long* A, size_t first, size_t size);
-size_t partition(long* A, size_t first, size_t size);
-void permuter(long* A,size_t i,size_t j);
-
-#endif //TRIS_H
diff --git a/TP2/tris.o b/TP2/tris.o
deleted file mode 100644
index feb455293f158d5d0ad902bbc1189c5183749779..0000000000000000000000000000000000000000
Binary files a/TP2/tris.o and /dev/null differ
diff --git a/TP2/utils.o b/TP2/utils.o
index 2408e3a0b5ba8709487bf1b2022345b78b83b3d0..d487d9077196f1ca3ea5b3bf0dc114120a8837ff 100644
Binary files a/TP2/utils.o and b/TP2/utils.o differ