forked from abraham/2026_TD3_DEV51_Qualite_Algo
fonction 10 : O(L)
This commit is contained in:
+1
-1
@@ -102,7 +102,7 @@ La complexité de la fonction est de <span style="color:blue">[O(n)]</span> pour
|
|||||||
|
|
||||||
- Optimisation de la fonction 9 nom du commit : "". Emprunte : ff68d260a7a58441
|
- Optimisation de la fonction 9 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||||
|
|
||||||
- Optimisation de la fonction 10 nom du commit : "". Emprunte : ff68d260a7a58441
|
- Optimisation de la fonction 10 nom du commit : "fonction 10 : O(L)". Emprunte : ff68d260a7a58441
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -235,10 +235,16 @@ int categorie(const Transaction *t)
|
|||||||
/* F10 : ajoute une ligne à la fin du rapport */
|
/* F10 : ajoute une ligne à la fin du rapport */
|
||||||
int longueur(const char *s)
|
int longueur(const char *s)
|
||||||
{
|
{
|
||||||
int n = 0;
|
static const char *chaine_connue = NULL;
|
||||||
while (s[n] != '\0')
|
static int n_connu = 0;
|
||||||
n++;
|
|
||||||
return n;
|
if (s != chaine_connue || s[0] == '\0') {
|
||||||
|
chaine_connue = s;
|
||||||
|
n_connu = 0;
|
||||||
|
}
|
||||||
|
while (s[n_connu] != '\0')
|
||||||
|
n_connu++;
|
||||||
|
return n_connu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ajouter_ligne(char *rapport, const char *ligne)
|
void ajouter_ligne(char *rapport, const char *ligne)
|
||||||
|
|||||||
Reference in New Issue
Block a user