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
53b9a6e4
Commit
53b9a6e4
authored
3 years ago
by
Pierre Kunzli
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into pk
parents
8a127afa
3e4713b8
Branches
Branches containing commit
Tags
Tags containing commit
4 merge requests
!6
Pk
,
!5
Pk
,
!4
correction recherche parent et ajout sauts slides
,
!3
Re re correction recherche
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides/cours_15.md
+8
-8
8 additions, 8 deletions
slides/cours_15.md
with
8 additions
and
8 deletions
slides/cours_15.md
+
8
−
8
View file @
53b9a6e4
...
@@ -398,7 +398,7 @@ droite(arbre) -> arbre (sous-arbre de droite)
...
@@ -398,7 +398,7 @@ droite(arbre) -> arbre (sous-arbre de droite)
# Exemple d'arbre binaire
# 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**.
...
@@ -586,7 +586,7 @@ Le noeud est visité à la **remontée**.
## Résultat
## Résultat
```
```
a * b
- c
* d + e / f
c -
a * b * d + e / f
```
```
::::
::::
...
@@ -877,11 +877,11 @@ int arbre_size(tree_t tree) {
...
@@ -877,11 +877,11 @@ int arbre_size(tree_t tree) {
```
```
arbre position(arbre, clé)
arbre position(arbre, clé)
si est_non_vide(arbre)
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)
tant que clé(arbre) != clé && est_non_vide(suivant)
si clé < clé(arbre)
suivant = gauche(arbre)
sinon
suivant = droite(arbre)
arbre = suivant
arbre = suivant
si clé < clé(arbre)
si clé < clé(arbre)
suivant = gauche(arbre)
suivant = gauche(arbre)
...
@@ -922,9 +922,9 @@ ajout(arbre, clé)
...
@@ -922,9 +922,9 @@ ajout(arbre, clé)
tree_t position(tree_t tree, key_t key) {
tree_t position(tree_t tree, key_t key) {
tree_t current = tree;
tree_t current = tree;
if (NULL != current) {
if (NULL != current) {
tree_t subtree = key > current->key ? current->right :
current->left;
while (key != current->key && NULL != subtree) {
while (key != current->key && NULL != subtree) {
subtree = key > current->key ? current->right :
current->left;
current = subtree;
current = subtree;
subtree = key > current->key ? current->right :
subtree = key > current->key ? current->right :
current->left;
current->left;
...
...
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