Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
ef135a95e0 |
@@ -1,6 +1,3 @@
|
||||
// Bubblesort Algorithm
|
||||
// M.Menault 2024
|
||||
|
||||
void bubblesort(int* array, int length)
|
||||
{
|
||||
int swapped, i, tmp;
|
||||
@@ -17,5 +14,5 @@ void bubblesort(int* array, int length)
|
||||
swapped++;
|
||||
}
|
||||
}
|
||||
} while(swapped==1);
|
||||
} while(swapped > 0);
|
||||
}
|
||||
|
8
compte_rendu.txt
Normal file
8
compte_rendu.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
Flat Profile :
|
||||
Temps et nombre d'éxecution de chaque fonction.
|
||||
|
||||
Call Graph :
|
||||
Voir arbre d'appel + temps et nb d'exec par fonction
|
||||
|
||||
Fonction la plus lente : bubblesort
|
||||
nombre d'appel important de bubblesort dans find_rank_student
|
@@ -1,5 +1,4 @@
|
||||
// Heapsort Algorithm
|
||||
// M.Menault 2024
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -47,13 +46,12 @@ void heapsort(int* array, int length)
|
||||
{
|
||||
int i = 0;
|
||||
int temp_value = 0;
|
||||
|
||||
// Sift the current array (binary tree)
|
||||
|
||||
for(i=(length/2); i >= 0; i--)
|
||||
{
|
||||
sift(array,i,length);
|
||||
}
|
||||
// Heapsort !
|
||||
|
||||
for(i=length-1; i > 0; i--)
|
||||
{
|
||||
temp_value = array[i];
|
||||
|
BIN
student_rank
Executable file
BIN
student_rank
Executable file
Binary file not shown.
@@ -1,5 +1,4 @@
|
||||
// Student rank
|
||||
// M.Menault 2024
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -55,7 +54,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);
|
||||
/*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);
|
||||
heapsort(grades,students_number);
|
||||
for(j = 0; j < students_number; j++)
|
||||
{
|
||||
students_rank[j][i] = find_rank_student(students_array[j][i],grades,students_number);
|
||||
|
Reference in New Issue
Block a user