From 6ceadece68180f78002e1c45da486cb2832afd2d Mon Sep 17 00:00:00 2001 From: Suwako Moriya Date: Sat, 10 Oct 2020 17:01:13 +0200 Subject: [PATCH] =?UTF-8?q?[OPT=20TP3]=20J'ai=20oubli=C3=A9=20de=20commit?= =?UTF-8?q?=20l'avant=20derni=C3=A8re=20question=20:c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SPE/OPT/TP 3/main.ml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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;; +