TD1_DEV51_Qualite_Algo/Notes.md

38 lines
1.1 KiB
Markdown
Raw Normal View History

2024-09-03 12:06:21 +02:00
# Compte rendu
```bash
gcc -g -pg -o student_rank student_rank.c heapsort.c bubblesort.c
```
```bash
./student_rank 5 5 1
```
```bash
gprof ./student_rank
```
Utilisation de gprof :
Après l'utilisation du -pg dans la compilation et le mode debug a 1 à l'execution, gprof [executable]
gprof1.txt -> ./student_rank 5 5 1
gprof2.txt -> ./student_rank 1000 1000 0
gprof3.txt -> ./student_rank 1000 10000 0
index % time self children called name
0.00 0.00 5/30 sort_students [9]
0.00 0.00 25/30 find_rank_student [2]
[1] 0.0 0.00 0.00 30 bubblesort [1]
-----------------------------------------------
0.00 0.00 25/25 sort_students [9]
[2] 0.0 0.00 0.00 25 find_rank_student [2]
0.00 0.00 25/30 bubblesort [1]
-----------------------------------------------
Bubblesort prend le + de temps à s'executer
Le bubblesort ligne 58 est inefficace et s'execute trop souvent car il trie un array deja trié
Le heapsort n'est pas plus optimisé dans ce cas là