let rec nb_element (a: 'a abin) : int = match a with Vide -> 0 | Noeud (r,gauche,droit) -> 1 + (nb_element gauche) + (nb_element droit);; somme des éléments dans un arbre : let rec somme_element (a: 'a abin) : int = match a with Vide -> 0 | Noeud (r,gauche,droit) -> r + (somme_element gauche) + (somme_element droit);; Plus grand élément ddans un arbre : let rec plusgrand (a:int abin) : int = match a with Noeud(r,gauche,droit) -> match gauche with Vide -> (match droit with Vide -> r | _ -> max r (plusgrand droit)) | _ -> (match droit with Vide -> max r (plusgrand gauche) | _ -> max r (max (plusgrand gauche) (plusgrand droit)));; let rec profondeur_dans (a:'a abin) (e:'a) : int = match a with Vide -> 0 |Noeud(r,gauche,droit) -> let pg=(profondeur_dans gauche e) and pd=(profondeur_dans droit e) in if (r=e) then 1 else if ((pg=0) && (pd=0)) then 0 else 1+(max pg pd);; let rec infixe (a:'a abin) : 'a list = match a with Vide -> [] | Noeud(r,gauche,droite) -> (infixe gauche)@[r]@(infixe droite);; let rec prefixe (a:'a abin) : 'a list = match a with Vide -> [] | Noeud(r,gauche,droite) -> r::(prefixe gauche)@(prefixe droite);; let rec postfixe (a:'a abin) : 'a list = match a with Vide -> [] | Noeud(r,gauche,droite) -> (postfixe gauche)@(postfixe droite)@[r];;