Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

4 changed files with 1 additions and 43 deletions

BIN
gmon.out

Binary file not shown.

View File

@ -1,42 +0,0 @@
notes Léo Rocher
./student_rank 5 5 1
gprof ./student_rank
-b pour enlever les explications
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
0.00 0.00 0.00 30 0.00 0.00 bubblesort
0.00 0.00 0.00 25 0.00 0.00 find_rank_student
0.00 0.00 0.00 10 0.00 0.00 print_array
0.00 0.00 0.00 5 0.00 0.00 generate_array
0.00 0.00 0.00 2 0.00 0.00 free_array
0.00 0.00 0.00 2 0.00 0.00 print_student_array
0.00 0.00 0.00 1 0.00 0.00 generate_grades
0.00 0.00 0.00 1 0.00 0.00 generate_ranks
0.00 0.00 0.00 1 0.00 0.00 sort_students
./student_rank 1000 1000 0
% cumulative self self total
time seconds seconds calls s/call s/call name
81.50 2.27 2.27 1001000 0.00 0.00 bubblesort
18.31 2.78 0.51 1000000 0.00 0.00 find_rank_student
0.36 2.79 0.01 1 0.01 2.79 sort_students
0.00 2.79 0.00 1000 0.00 0.00 generate_array
0.00 2.79 0.00 2 0.00 0.00 free_array
0.00 2.79 0.00 1 0.00 0.00 generate_grades
0.00 2.79 0.00 1 0.00 0.00 generate_ranks
time ./student_rank 1000 1000 0
real 0m2.844s
user 0m2.818s
sys 0m0.007s
trop d'appel à bubblesort, il y a un appel à la fonction en trop l.58 dans la fonction find rank de student_rank.c.
--> gain de temps

Binary file not shown.

View File

@ -55,7 +55,7 @@ int find_rank_student(int student_grade, int* grades_array, int students_number)
{
int position = -1;
int i = 0;
// bubblesort(grades_array,students_number); en trop
bubblesort(grades_array,students_number);
for(i = students_number-1; i >= 0; i--)
{
if(grades_array[i] == student_grade)