diff --git a/SPE/OPT/TP 3/main.ml b/SPE/OPT/TP 3/main.ml index ed80307..733a89f 100644 --- a/SPE/OPT/TP 3/main.ml +++ b/SPE/OPT/TP 3/main.ml @@ -62,6 +62,11 @@ reconstruit test;; let rebalance t = match t with |Vide -> Vide - |Noeud(i,_,fg,fd) -> let n = float_of_int i in if ((taille fg) < alpha*.n ) && ((taille fd) < alpha*.n) then t else reconstruit t;; -float_of_int;; -alpha* float_of_int.5;; \ No newline at end of file + |Noeud(i,_,fg,fd) -> let n = float_of_int i in if (float_of_int (taille fg) < alpha*.n ) && (float_of_int (taille fd) < alpha*.n) then t else reconstruit t;; +rebalance test;; + +let rec insere_be a t = match t with + |Vide -> creer_noeud a Vide Vide + |_ -> let Noeud(i,e,fg,fd) = rebalance t in if a <= e then creer_noeud e (insere_be a fg) fd else creer_noeud e fg (insere_be a fd);; +insere_be 3 test;; +