Skip to content
Snippets Groups Projects
Commit 53b9a6e4 authored by Pierre Kunzli's avatar Pierre Kunzli
Browse files

Merge branch 'master' into pk

parents 8a127afa 3e4713b8
No related branches found
No related tags found
4 merge requests!6Pk,!5Pk,!4correction recherche parent et ajout sauts slides,!3Re re correction recherche
......@@ -398,7 +398,7 @@ droite(arbre) -> arbre (sous-arbre de droite)
# Exemple d'arbre binaire
* Représentez `(a * b - c) * (d + e / f)` à l'aide d'un arbre binaire (matrix)
* Représentez `(c - a * b) * (d + e / f)` à l'aide d'un arbre binaire (matrix)
. . .
......@@ -586,7 +586,7 @@ Le noeud est visité à la **remontée**.
## Résultat
```
a * b - c * d + e / f
c - a * b * d + e / f
```
::::
......@@ -877,11 +877,11 @@ int arbre_size(tree_t tree) {
```
arbre position(arbre, clé)
si est_non_vide(arbre)
si clé < clé(arbre)
suivant = gauche(arbre)
sinon
suivant = droite(arbre)
tant que clé(arbre) != clé && est_non_vide(suivant)
si clé < clé(arbre)
suivant = gauche(arbre)
sinon
suivant = droite(arbre)
arbre = suivant
si clé < clé(arbre)
suivant = gauche(arbre)
......@@ -922,9 +922,9 @@ ajout(arbre, clé)
tree_t position(tree_t tree, key_t key) {
tree_t current = tree;
if (NULL != current) {
tree_t subtree = key > current->key ? current->right :
current->left;
while (key != current->key && NULL != subtree) {
subtree = key > current->key ? current->right :
current->left;
current = subtree;
subtree = key > current->key ? current->right :
current->left;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment