From 6565163d112807639d5170cacd8c5a37b481547a Mon Sep 17 00:00:00 2001 From: gallego Date: Wed, 15 Oct 2025 16:26:07 +0200 Subject: [PATCH] finie ! --- .vscode/settings.json | 7 ++++ Exo1.c | 35 +++++++++++++++++++ Exo2.c | 43 +++++++++++++++++++++++ Exo3.c | 76 ++++++++++++++++++++++++++++++++++++++++ Reponses.txt | 79 ++++++++++++++++++++++++++++++++++++++++++ gmon.out | Bin 0 -> 2975 bytes 6 files changed, 240 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 Exo1.c create mode 100644 Exo2.c create mode 100644 Exo3.c create mode 100644 Reponses.txt create mode 100644 gmon.out diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c0fd1a0 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "files.associations": { + "time.h": "c", + "stdio.h": "c", + "stdlib.h": "c" + } +} \ No newline at end of file diff --git a/Exo1.c b/Exo1.c new file mode 100644 index 0000000..af81e75 --- /dev/null +++ b/Exo1.c @@ -0,0 +1,35 @@ +#include + +TAILLE_TAB = 10000; + +int racineCarree(int n){ + if (n < 0){ + return -2; + } + for(int i = 0; i +#include +#include + + +int TAILLE_TAB = 10000; + +int racineCarree(int n){ + if (n < 0){ + return -2; + } + for(int i = 0; i +#include +#include +int TAILLE_TAB = 4; + +int racineCarree(int n){ + if (n < 0){ + return -2; + } + for(int i = 0; i +[3] 100.0 0.00 13.59 main [3] + 0.00 13.59 1/1 racineCarreeTab [2] +----------------------------------------------- + +complexité cyclomatique + +racineCarree() = 5 +racineCarreeTab() = 2 + +Complexité algorithmique + +racineCarree() = O(n) +racineCarreeTab() = O(t*n) avec t = taille du tableau + +Exercice 3 + +Pour compiler : gcc -pg -std=c99 Exo3.c + +Exercice 4 + +Pour profiler avec gprof on entre la commande gprof ./a.out après avoir compiler le code + +Flat profile: + +Each sample counts as 0.01 seconds. + no time accumulated + + % cumulative self self total + time seconds seconds calls Ts/call Ts/call name + 0.00 0.00 0.00 6 0.00 0.00 racineCarree + 0.00 0.00 0.00 1 0.00 0.00 TriSpecial + +Call graph (explanation follows) + + +granularity: each sample hit covers 2 byte(s) no time propagated + +index % time self children called name + 0.00 0.00 6/6 TriSpecial [2] +[1] 0.0 0.00 0.00 6 racineCarree [1] +----------------------------------------------- + 0.00 0.00 1/1 main [6] +[2] 0.0 0.00 0.00 1 TriSpecial [2] + 0.00 0.00 6/6 racineCarree [1] +----------------------------------------------- + +La complexité cyclomatique de TriSpecial() est de 10 +La complexité algorithmique de TriSpecial() est O(t*n) avec t la taille du tableau \ No newline at end of file diff --git a/gmon.out b/gmon.out new file mode 100644 index 0000000000000000000000000000000000000000..e12c16e33ba6bb68d25ef5c776418a44e6946ee9 GIT binary patch literal 2975 zcmYe#&Cg?GzyVUkAQE#}85mL+7#NCElk@XZiXnmw3~&ZaV3ZyWfzc2c4S~@R7!85Z q5Eu=C(GVC7fzc4a3;{+5VTj-}K?u#lz`($GK@`H7F9e}M&2j+VV+nfz literal 0 HcmV?d00001