diff --git a/slides/cours_6.md b/slides/cours_6.md index 075eab414349d07c263a0a25b14694632d37d0b7..fcb044df3c12c317246c477637d0ff0da47d4e85 100644 --- a/slides/cours_6.md +++ b/slides/cours_6.md @@ -153,13 +153,17 @@ int pow(int x, int n) { return 1; } for (int i = 1; i < n; ++i) { - x *= x; + x = x * x; // x *= x } return x; } ``` -* Complexité? Combien de multiplication en fonction de `n`? +* Combien de multiplication et d'assignations en fonction de `n`? + +. . . + +* `n` assignations et `n` multiplications. # Exponentiation rapide ou indienne (2/4) @@ -233,8 +237,7 @@ Comment mesurer l'efficacité d'un algorithme? . . . -Dépendant du **matériel**, du **compilateur**, des **options de compilation**, -etc! +Dépendant du **matériel**, du **compilateur**, des **options de compilation**, etc! ## Mesure du temps CPU @@ -436,7 +439,7 @@ $$ ## Complexité de trouver le minimum d'un tableau? ```C -min = MAX; +int min = MAX; for (i = 0; i < N; ++i) { if (tab[i] < min) { min = tab[i]; @@ -458,7 +461,7 @@ $$ ## Complexité du tri par sélection? ```C -ind = 0 +int ind = 0 while (ind < SIZE-1) { min = find_min(tab[ind:SIZE]); swap(min, tab[ind]); diff --git a/source_codes/arbres_AVL/.gitignore b/source_codes/arbres_AVL/.gitignore index f8a1ca8adedba78aa24db2659b28c80e68e737f0..1d1d030bf8e1599a3bfadade116fa8733f933f38 100644 --- a/source_codes/arbres_AVL/.gitignore +++ b/source_codes/arbres_AVL/.gitignore @@ -2,3 +2,7 @@ bin_tree.o avl.o main main.o +bin_tree.o +avl.o +main +main.o