|
|
|
| algo d parcours d'un arbre binaire par fatine |
jeudi 28 juin 2001 à 14:47:42 |
Parcours d'un fichier binaire? |
Trois possibilités de parcours (je ne me rapelle plus des noms):
- la pré-je-sais-plus-quoi: tu traite le noeud, tu fais la partie gauche, tu fais la partie droite, - la je-sais-plus-quoi: tu fais la partie gauche, tu traite le noeud, tu fais la partie droite, - la post-je-sais-plus-quoi: tu fais la partie gauche, tu fais la partie droite, tu traite le noeud. Voici l'algo: fonction sag(): renvoie le sous-arbre gauche fonction sad(): renvoie le sous-arbre droit fonction parcourir(unarbre: type_arbre): var unnoeud: type_noeud {1} traiter(unnoeud); si sag(unarbre) est_non_vide alors parcourir(sag(unarbre)) finsi {2} traiter(unnoeud); si sad(unarbre) est_non_vide alors parcourir(sad(unarbre)) finsi {3} traiter(unnoeud); fin parcourir Selon si tu mets le traiter(unnoeud) en 1 ou en 2 ou en 3, ça donne pas la même chose (fais un dessin). Info Man
|
| 13/01 17h14 | ARBRES BINAIRES | Programmation | 13/01 18h17 | 4 |
| 18/11 09h44 | Arbres binaire C: fichier ou memoire??? | Programmation | 18/11 23h49 | 4 |
| 10/10 20h48 | Probleme de segmentation sur arbre binaire. | Programmation | 11/10 10h53 | 8 |
| 16/03 16h02 | exercice d'un arbre binaire de recher | Programmation | 16/03 16h02 | 0 |