diff --git a/.gitignore b/.gitignore index 102493fcbe0bd4344eca159e93358250d71531f4..44a3df248ffb884e4a789a8fe95216394890c3de 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,15 @@ */*~ - +Python/__pycache__/* Sujets/*.tex Sujets/*.aux Sujets/*.bak -Sujets/*.log \ No newline at end of file +Sujets/*.log +Sujets/*.ods + +Corrections/* + +Java/*.class +Java/.idea + +plots/plot_files/* +plots/png/* \ No newline at end of file diff --git a/C/arraylist.c b/C/arraylist.c index 32d45a628e1102bfb4b2232078a2715d69dd1387..1fbeeec0945d0dc0a985fb538922ea331b647129 100644 --- a/C/arraylist.c +++ b/C/arraylist.c @@ -60,7 +60,7 @@ size_t arraylist_capacity(arraylist_t * a){ } char arraylist_do_we_need_to_enlarge_capacity(arraylist_t * a){ - return ( a->size >= (a->capacity * 3)/4 )? TRUE: FALSE; + return a->size == a->capacity ? TRUE: FALSE; } void arraylist_enlarge_capacity(arraylist_t * a){ diff --git a/CPP/arraylist.hpp b/CPP/arraylist.hpp index 7f9331caa8ed34673e6d298127bbb791e9d7a501..be35de5b38dca78d5e8db1f6f527803170eae387 100644 --- a/CPP/arraylist.hpp +++ b/CPP/arraylist.hpp @@ -89,7 +89,7 @@ private: @returns true si le tableau doit être agrandi, false sinon. */ bool do_we_need_to_enlarge_capacity(){ - return data.size() >= (data.capacity() * 3)/4; + return data.size() == data.capacity(); } /** diff --git a/Java/ArrayList.java b/Java/ArrayList.java index 4c259b84aae309ad07efb8c41e02f5a47696d129..3401432985664459f76e9c8ab09488cb5c6894b9 100644 --- a/Java/ArrayList.java +++ b/Java/ArrayList.java @@ -83,7 +83,7 @@ public class ArrayList<T> { @returns true si le tableau doit être agrandi, false sinon. */ private boolean do_we_need_to_enlarge_capacity() { - return size >= (capacity * 3)/4; + return size == capacity; } /** diff --git a/Python/main.py b/Python/main.py index 9634cb4e2e0c882e941a022f3c55c5e10038a8bb..e999e9975e55f55e72cd236d91d91b3d5bdbb4fd 100644 --- a/Python/main.py +++ b/Python/main.py @@ -5,7 +5,7 @@ from arraylist import ArrayListProxy from analyzer import Analyzer # Tableau dynamique. -a = ArrayListProxy() +a = [] # Analyse du temps pris par les operations. time_analysis = Analyzer(); diff --git a/README.md b/README.md index 422ec13f86a90b528899f8ed5b26bb197c8026c7..7e4f98f1647b484c9f66e079dd7c6e299983b3da 100644 --- a/README.md +++ b/README.md @@ -41,12 +41,16 @@ python main.py cd .. # Observation des résultats -### Dans le répertoire courant, lisez le contenu du fichier plot_result +### Dans le répertoire plots, lisez le contenu du fichier plot_result +cd plots more plot_result -### puis lancez gnuplot +### puis lancez ce script avec gnuplot -gnuplot +gnuplot plot_result + +### Regardez à présent les courbes obtenus dans le répertoire eps/ + +gv eps/dynamic_array_amortized_time_alpha_2.eps -### puis copiez le contenu du fichier plot_result dans gnuplot (3 lignes, une par une) \ No newline at end of file diff --git a/plots/plot_result b/plots/plot_result index 5118dc05d0c3bcbef51900e5a9a2dd96f0572236..1035e00985b687a66c7cd2321a135d1b59fcff99 100644 --- a/plots/plot_result +++ b/plots/plot_result @@ -14,7 +14,7 @@ set ylabel "Temps amorti" font "Helvetica,24" # Nom du fichier Postscript en sortie set output 'eps/dynamic_array_amortized_time_alpha_2.eps' -plot [0:1000000][0:600] 'plot_files/dynamic_array_time_c.plot' using 1:3 w lines title "Amortized C", 'plot_files/dynamic_array_time_cpp.plot' using 1:3 w lines title "Amortized C++", 'plot_files/dynamic_array_time_java.plot' using 1:3 w lines title "Amortized JAVA", 'plot_files/dynamic_array_time_python.plot' using 1:3 w lines title "Amortized Python" +plot [0:1000000][0:1000] 'dynamic_array_time_c.plot' using 1:3 w lines title "Amortized C", 'dynamic_array_time_cpp.plot' using 1:3 w lines title "Amortized C++", 'dynamic_array_time_java.plot' using 1:3 w lines title "Amortized JAVA", 'dynamic_array_time_python.plot' using 1:3 w lines title "Amortized Python" ############################################################### ########### Affichage de l'espace mémoire gaspillé ########### @@ -25,7 +25,7 @@ set ylabel "Mémoire gaspillée" font "Helvetica,24" # Nom du fichier Postscript en sortie set output 'eps/dynamic_array_wasted_memory_alpha_2.eps' -plot 'plot_files/dynamic_array_memory_c.plot' using 1:2 w lines title "Espace memoire inutilise" +plot 'dynamic_array_memory_c.plot' using 1:2 w lines title "Espace memoire inutilise" ################################################################# ########### Affichage du nombre de copies effectuées ########### @@ -36,4 +36,4 @@ set ylabel "Nombre de copie effectuée" font "Helvetica,24" # Nom du fichier Postscript en sortie set output 'eps/dynamic_copy_alpha_2.eps' -plot 'plot_files/dynamic_array_copy_c.plot' using 1:2 w boxes title "Nombre de copies de valeurs effectuees" \ No newline at end of file +plot 'dynamic_array_copy_c.plot' using 1:2 w boxes title "Nombre de copies de valeurs effectuees" \ No newline at end of file