diff --git a/bubblesort.c b/bubblesort.c index a848827..2fb0d04 100644 --- a/bubblesort.c +++ b/bubblesort.c @@ -14,8 +14,12 @@ void bubblesort(int* array, int length) tmp = array[i-1]; array[i-1] = array[i]; array[i] = tmp; - swapped++; + swapped=1; } } } while(swapped==1); } + + + + diff --git a/compte_rendue.md b/compte_rendue.md new file mode 100644 index 0000000..e5bc473 --- /dev/null +++ b/compte_rendue.md @@ -0,0 +1,13 @@ +on s'est rendu compte que bubblesort et find_rank_student font enormement d'appel et qu'il prenne tous autant de temps +on va donc regarder leurs codes et voir ce qui peut etre optimiser + +ps : le code est pas commenter j'aime pas (Maxime Lebreton) +pps : Ouais j'suis d'accord avec mon camarade ci-dessus, la prochaine fois faite des faux commentaires pour nous rendre encore plus confus. (Marvin Aubert) + +il y avait 2 appel de bubblesort j'ai retirer le mauvais donc le temps n'étais pas gagné après la suppression du bon le code est bien plus rapide + + + + +Maxime LEBRETON +Marvin AUBERT \ No newline at end of file diff --git a/gmon.out b/gmon.out new file mode 100644 index 0000000..2e71f45 Binary files /dev/null and b/gmon.out differ diff --git a/short.c b/short.c new file mode 100644 index 0000000..e69de29 diff --git a/student_rank b/student_rank new file mode 100755 index 0000000..6d7841d Binary files /dev/null and b/student_rank differ diff --git a/student_rank.c b/student_rank.c index af84003..e4db195 100644 --- a/student_rank.c +++ b/student_rank.c @@ -55,7 +55,6 @@ int find_rank_student(int student_grade, int* grades_array, int students_number) { int position = -1; int i = 0; - bubblesort(grades_array,students_number); for(i = students_number-1; i >= 0; i--) { if(grades_array[i] == student_grade) @@ -77,7 +76,7 @@ void sort_students(int** students_rank, int** students_array, int students_numbe { grades[j] = students_array[j][i]; } - bubblesort(grades,students_number); + bubblesort(grades,students_number); for(j = 0; j < students_number; j++) { students_rank[j][i] = find_rank_student(students_array[j][i],grades,students_number);