Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cours
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
algorithmique
cours
Commits
700cb65d
Commit
700cb65d
authored
3 weeks ago
by
paul.albuquer
Browse files
Options
Downloads
Patches
Plain Diff
changed named and structure suppression
parent
a3539480
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#38370
passed
3 weeks ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/cours_17.md
+18
-20
18 additions, 20 deletions
slides/cours_17.md
with
18 additions
and
20 deletions
slides/cours_17.md
+
18
−
20
View file @
700cb65d
...
...
@@ -239,24 +239,22 @@ flowchart TB;
# Le pseudo-code de la suppression
## Pour une feuille ou absent (ensemble)
## Pour une feuille ou
clé
absent
e
(ensemble)
```
arbre suppression(tree, clé)
sub_tree = position(tree, clé)
si est_vide(sub_tree) ou clé(sub_tree) != clé
retourne vide
sinon
si est_feuille(sub_tree) et clé(sub_tree) == clé
nouvelle_feuille = parent(tree, sub_tree)
si est_vide(nouvelle_feuille)
arbre = vide
sinon
si gauche(nouvelle_feuille) == sub_tree
gauche(nouvelle_feuille) = vide
sinon
droite(nouvelle_feuille) = vide
retourne sub_tree
booléen suppression(tree, clé)
noeud = position(tree, clé)
si est_vide(noeud) ou clé(noeud) != clé
retourne faux
si est_feuille(noeud)
noeud_parent = parent(tree, noeud)
si est_vide(noeud_parent)
noeud = vide
sinon si gauche(noeud_parent) == noeud
gauche(noeud_parent) = vide
sinon si droite(noeud_parent) == noeud
droite(noeud_parent) = vide
retourne vrai
```
# Il nous manque le code pour le `parent`
...
...
@@ -266,11 +264,11 @@ arbre suppression(tree, clé)
. . .
```
arbre parent(tree,
sub_tree
)
arbre parent(tree,
noeud
)
si est_non_vide(tree)
actuel = tree
parent = actuel
clé = clé(
sub_tree
)
clé = clé(
noeud
)
faire
si (clé != clé(actuel))
parent = actuel
...
...
@@ -279,8 +277,8 @@ arbre parent(tree, sub_tree)
sinon
actuel = droite(actuel)
sinon
retour parent
tant_que (actuel !=
sub_tree
)
retour
ne
parent
tant_que (actuel !=
noeud
)
retourne vide
```
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment