Skip to content
Snippets Groups Projects
Commit 417348fd authored by orestis.malaspin's avatar orestis.malaspin
Browse files

Merge branch 'pk' into 'master'

Nouvelle correction de l'algo de recherche

See merge request !2
parents 1e82f60b 6f75d181
No related branches found
No related tags found
1 merge request!2Nouvelle correction de l'algo de recherche
Pipeline #15715 passed
......@@ -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
returne arbre
```
......@@ -917,9 +917,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;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment