Les fonctions racine, fils_gauche, fils_droit renvoient respectivement l’étiquette, l’arbre fils gauche et l’arbre fils droit du noeud situé à la racine. La fonction swap_racine renvoie l’arbre obtenu en échangeant les deux sous-arbres de la racine :
|
1 2 3 4 |
let racine a = match a with | Vide -> failwith "arbre vide" | Noeud(_, e, _) -> e;; val racine : 'a arbre -> 'a = <fun> |
|
1 2 3 4 |
let fils_gauche a = match a with | Vide -> failwith "arbre vide" | Noeud(g, _, _) -> g;; val fils_gauche : 'a arbre -> 'a arbre = <fun> |
|
1 2 3 4 |
let fils_droit a = match a with | Vide -> failwith "arbre vide" | Noeud(_, _, d) -> d;; val fils_droit : 'a arbre -> 'a arbre = <fun> |
- avoir une souscription active sur mathprepa
- et être connecté au site
- revenir à la page d'accueil
- ou tester la page d'extraits libres