diff --git a/Algos_1/graphe.png b/Algos_1/Images/graphe.png similarity index 100% rename from Algos_1/graphe.png rename to Algos_1/Images/graphe.png diff --git a/Algos_1/main.c b/Algos_1/Lib/main.c similarity index 97% rename from Algos_1/main.c rename to Algos_1/Lib/main.c index 7ca30243f978837935b27ea1ad8423036dd93b23..ba6e932993dd06bf78dc1bba4716eb83177d73f0 100644 --- a/Algos_1/main.c +++ b/Algos_1/Lib/main.c @@ -1,7 +1,7 @@ -#include "triInsertion.h" -#include "triFusion.h" -#include "triRapide.h" -#include "utils.h" +#include "../Tris/triInsertion.h" +#include "../Tris/triFusion.h" +#include "../Tris/triRapide.h" +#include "../Lib/utils.h" int main(int argc, char **argv){ if(argc<3){ diff --git a/Algos_1/utils.c b/Algos_1/Lib/utils.c similarity index 100% rename from Algos_1/utils.c rename to Algos_1/Lib/utils.c diff --git a/Algos_1/utils.h b/Algos_1/Lib/utils.h similarity index 100% rename from Algos_1/utils.h rename to Algos_1/Lib/utils.h diff --git a/Algos_1/perf.R b/Algos_1/R/perf.R similarity index 100% rename from Algos_1/perf.R rename to Algos_1/R/perf.R diff --git a/Algos_1/perf.dat b/Algos_1/Scripts/perf.dat similarity index 100% rename from Algos_1/perf.dat rename to Algos_1/Scripts/perf.dat diff --git a/Algos_1/perf.sh b/Algos_1/Scripts/perf.sh similarity index 71% rename from Algos_1/perf.sh rename to Algos_1/Scripts/perf.sh index 309b5b2348cca5481e0c2f4edd5d490bf868269a..1e89cdb8a1545dd03a7d8a492f7603ca40ca304e 100755 --- a/Algos_1/perf.sh +++ b/Algos_1/Scripts/perf.sh @@ -7,12 +7,12 @@ do size=$(( `od -An -N4 -tu < /dev/urandom` % 1000000)) max=$(( `od -An -N4 -tu < /dev/urandom` % 1000)) - ./tri -g $max $size 1>tabs/perf_tab.txt + ../tri -g $max $size 1>tabs/perf_tab.txt #cat tabs/perf_tab.txt for tri in "fusion" "insertion" "rapide" do - res=$( time ./tri --$tri tabs/perf_tab.txt 2>&1) + res=$( time ../tri --$tri ../tabs/perf_tab.txt 2>&1) echo -e "$iTest\t$taille\t$tri\t$res" done - rm tabs/perf_tab.txt + rm ../tabs/perf_tab.txt done \ No newline at end of file diff --git a/Algos_1/perf_bis.sh b/Algos_1/Scripts/perf_bis.sh similarity index 100% rename from Algos_1/perf_bis.sh rename to Algos_1/Scripts/perf_bis.sh diff --git a/Algos_1/triFusion.c b/Algos_1/Tris/triFusion.c similarity index 100% rename from Algos_1/triFusion.c rename to Algos_1/Tris/triFusion.c diff --git a/Algos_1/triFusion.h b/Algos_1/Tris/triFusion.h similarity index 95% rename from Algos_1/triFusion.h rename to Algos_1/Tris/triFusion.h index 783da912798b526b02ef15337042a47fc3811e2e..b108005fe9cc8757e525c64dc19e0f2b418b4454 100644 --- a/Algos_1/triFusion.h +++ b/Algos_1/Tris/triFusion.h @@ -12,7 +12,7 @@ #include <fcntl.h> #include <string.h> -#include "utils.h" +#include "../Lib/utils.h" void sousTriFusion(long * A, size_t p, size_t r); void fusion(long * A, size_t p, size_t q, size_t r); diff --git a/Algos_1/triInsertion.c b/Algos_1/Tris/triInsertion.c similarity index 100% rename from Algos_1/triInsertion.c rename to Algos_1/Tris/triInsertion.c diff --git a/Algos_1/triInsertion.h b/Algos_1/Tris/triInsertion.h similarity index 92% rename from Algos_1/triInsertion.h rename to Algos_1/Tris/triInsertion.h index 7bc388b1125a9d63a1ca8315dfc681d50f03f364..77fa91ff7071c83e03bc35e57705939640ff766f 100644 --- a/Algos_1/triInsertion.h +++ b/Algos_1/Tris/triInsertion.h @@ -11,7 +11,7 @@ #include <fcntl.h> #include <string.h> -#include "utils.h" +#include "../Lib/utils.h" void triInsertion(long* A, size_t n); diff --git a/Algos_1/triRapide.c b/Algos_1/Tris/triRapide.c similarity index 100% rename from Algos_1/triRapide.c rename to Algos_1/Tris/triRapide.c diff --git a/Algos_1/triRapide.h b/Algos_1/Tris/triRapide.h similarity index 95% rename from Algos_1/triRapide.h rename to Algos_1/Tris/triRapide.h index 618b74da86c76cb3ee699273e0a10953634ed946..a6a9e967f854249678a3327d9d4e79f41c99716f 100644 --- a/Algos_1/triRapide.h +++ b/Algos_1/Tris/triRapide.h @@ -11,7 +11,7 @@ #include <fcntl.h> #include <string.h> -#include "utils.h" +#include "../Lib/utils.h" void triRapide(long* A, size_t n); size_t partition(long* A, size_t p, size_t r); diff --git a/Algos_1/algos.c b/Algos_1/algos.c deleted file mode 100644 index acc21a9f09d55afad868c17d48202b5a742f2b12..0000000000000000000000000000000000000000 --- a/Algos_1/algos.c +++ /dev/null @@ -1,108 +0,0 @@ -#include "algos.h" -#include <string.h> - -void triInsertion(long* A, size_t n){ - long cle = 0; - size_t max = 0; max--; - for(size_t i = 1; i<n; i++){ - cle=A[i]; - size_t j = i - 1; - while (j != max && A[j] > cle ){ - A[j+1] = A[j]; - j = j-1; - } - A[j+1] = cle; - } -} - - -void sousTriFusion(long * A, size_t p, size_t r){ - if(p<(r-1)){ - size_t q = (size_t)((p+r)/2); - sousTriFusion(A, p, q); - sousTriFusion(A, q, r); - fusion(A, p, q, r); - } -} - -void fusion(long * A, size_t p, size_t q, size_t r){ - size_t n1 = q-p; - size_t n2 = r-q; - - long Ad[n2]; - memset(Ad, 0, n2); - int j =0; - for(size_t i = q; i<r; i++){ - Ad[j] = A[i]; - j++; - } - - long Ag[n1]; - memset(Ag, 0, n1); - j =0; - for(size_t i = p; i<q; i++){ - Ag[j] = A[i]; - j++; - } - - size_t indg = 0; - size_t indd = 0; - size_t i = p; - while (i < r){ - 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++; - } -} - -void triFusion(long * A, size_t n){ - sousTriFusion(A, 0, n); -} - -void sousTriRapide(long* A, size_t p, size_t r) { - size_t max = 0; max--; - if(r-1 != max){ - if (p<(r-1)) { - size_t q = partition(A, p, r); - sousTriRapide(A, p, q); - sousTriRapide(A, q+1, r); - } - } - -} - -size_t partition(long* A, size_t p, size_t r) { - long pivot = A[r-1]; - - size_t i = p; - for (size_t j = p; j <= r-2; j++) { - if (A[j] <= pivot) { - long temp = A[i]; - A[i] = A[j]; - A[j] = temp; - i++; - } - } - long temp = A[i]; - A[i] = A[r-1]; - A[r-1] = temp; - return i; -} - -void triRapide(long* A, size_t n) { - sousTriRapide(A, 0, n); -} \ No newline at end of file diff --git a/Algos_1/algos.h b/Algos_1/algos.h deleted file mode 100644 index 87d0e0ab391f302b1b3dbf0e54fa4353e8fe564b..0000000000000000000000000000000000000000 --- a/Algos_1/algos.h +++ /dev/null @@ -1,17 +0,0 @@ -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <fcntl.h> - - -void triInsertion(long* A, size_t n); -void sousTriFusion(long * A, size_t p, size_t r); -void fusion(long * A, size_t p, size_t q, size_t r); -void triFusion(long * A, size_t n); -void triRapide(long* A, size_t n); -size_t partition(long* A, size_t p, size_t r); -void sousTriRapide(long* A, size_t p, size_t r); diff --git a/Algos_1/algos.o b/Algos_1/algos.o deleted file mode 100644 index d6ac934c984060b2a1e49881fa9ffa3c0df8ed03..0000000000000000000000000000000000000000 Binary files a/Algos_1/algos.o and /dev/null differ diff --git a/Algos_1/fusion b/Algos_1/fusion deleted file mode 100755 index c5e0708a954792e1196f81e54e17bdfe67f7f707..0000000000000000000000000000000000000000 --- a/Algos_1/fusion +++ /dev/null @@ -1 +0,0 @@ -383 886 777 915 793 . diff --git a/Algos_1/fusion.dot b/Algos_1/fusion.dot deleted file mode 100644 index c5e0708a954792e1196f81e54e17bdfe67f7f707..0000000000000000000000000000000000000000 --- a/Algos_1/fusion.dot +++ /dev/null @@ -1 +0,0 @@ -383 886 777 915 793 . diff --git a/Algos_1/makefile b/Algos_1/makefile index abccfb855565a981837f3913ea267b234b711e54..a0fbfc04ffc206aeca04ce66faaf7a77daac460c 100644 --- a/Algos_1/makefile +++ b/Algos_1/makefile @@ -1,19 +1,19 @@ all: tri -tri: main.c triInsertion.o triFusion.o triRapide.o utils.o - gcc -Wall main.c triInsertion.o triFusion.o triRapide.o utils.o -Wall -o tri +tri: Lib/main.c Tris/triInsertion.o Tris/triFusion.o Tris/triRapide.o Lib/utils.o + gcc -Wall Lib/main.c Tris/triInsertion.o Tris/triFusion.o Tris/triRapide.o Lib/utils.o -Wall -o tri -insertion: triInsertion.c triInsertion.h - gcc -c triInsertion.c triInsertion.h -Wall +insertion: Tris/triInsertion.c Tris/triInsertion.h + gcc -c Tris/triInsertion.c Tris/triInsertion.h -Wall -fusion: triFusion.c triFusion.h - gcc -c triFusion.c triFusion.h -Wall +fusion: Tris/triFusion.c Tris/triFusion.h + gcc -c Tris/triFusion.c Tris/triFusion.h -Wall -rapide: triRapide.c triRapide.h - gcc -c triRapide.c triRapide.h -Wall +rapide: Tris/triRapide.c Tris/triRapide.h + gcc -c Tris/triRapide.c Tris/triRapide.h -Wall -utils: utils.c utils.h - gcc -c utils.c utils.h -Wall +utils: Lib/utils.c Lib/utils.h + gcc -c Lib/utils.c Lib/utils.h -Wall clear: rm *.o \ No newline at end of file diff --git a/Algos_1/triFusion.o b/Algos_1/triFusion.o deleted file mode 100644 index e37a2b038eba194723b1ff08c4b2eba76741952e..0000000000000000000000000000000000000000 Binary files a/Algos_1/triFusion.o and /dev/null differ diff --git a/Algos_1/triInsertion.o b/Algos_1/triInsertion.o deleted file mode 100644 index be650cca46e5f3bb8cd993559ba0dbb2e2ea08a9..0000000000000000000000000000000000000000 Binary files a/Algos_1/triInsertion.o and /dev/null differ diff --git a/Algos_1/triRapide.o b/Algos_1/triRapide.o deleted file mode 100644 index 8c0bd136e5c3d148b9a7306e4f863df3086636af..0000000000000000000000000000000000000000 Binary files a/Algos_1/triRapide.o and /dev/null differ diff --git a/Algos_1/utils.o b/Algos_1/utils.o deleted file mode 100644 index 91dd2cecdfbad28ec4a14e8f6421947a595cba4f..0000000000000000000000000000000000000000 Binary files a/Algos_1/utils.o and /dev/null differ