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

fix parent search algo

parent 4530c003
No related branches found
No related tags found
No related merge requests found
......@@ -883,6 +883,10 @@ arbre position(arbre, clé)
suivant = droite(arbre)
tant que clé(arbre) != clé && est_non_vide(suivant)
arbre = suivant
si clé < clé(arbre)
suivant = gauche(arbre)
sinon
suivant = droite(arbre)
returne arbre
```
......@@ -921,6 +925,8 @@ tree_t position(tree_t tree, key_t key) {
current->left;
while (key != current->key && NULL != subtree) {
current = subtree;
subtree = key > current->key ? current->right :
current->left;
}
}
return current;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment