From: Mart Lubbers Date: Tue, 24 Mar 2015 15:10:00 +0000 (+0100) Subject: h X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=6e732075e3861dd74917600a15e300ec5cf556aa;p=fp1415.git h --- diff --git a/week7/mart/BinSearchTree.icl b/week7/mart/BinSearchTree.icl index 92e7548..8f9f05c 100644 --- a/week7/mart/BinSearchTree.icl +++ b/week7/mart/BinSearchTree.icl @@ -3,15 +3,104 @@ implementation module BinSearchTree import StdEnv import BinTree -z0 = Leaf -z1 = insertTree 50 z0 -z2 = insertTree 10 z1 -z3 = insertTree 75 z2 -z4 = insertTree 80 z3 -z5 = insertTree 77 z4 -z6 = insertTree 10 z5 -z7 = insertTree 75 z6 -z8 = deleteTree 50 z7 + +z0 + Leaf +z1 + 50 + | + ---------- + | | + Leaf Leaf +z2 + 50 + | + ---------- + | | + 10 Leaf + | + ------ + | | + Leaf Leaf +z3 + 50 + | + ---------- + | | + 10 75 + | | + ------ ------ + | | | | + Leaf Leaf Leaf Leaf +z4 + 50 + | + ---------- + | | + 10 75 + | | + ------ ------ + | | | | + Leaf Leaf Leaf 80 + | + ------ + | | + Leaf Leaf +z5 + 50 + | + ---------- + | | + 10 75 + | | + ------ ------ + | | | | + Leaf Leaf Leaf 77 + | + ------ + | | + Leaf 80 + | + ------ + | | + Leaf Leaf +z6 + 50 + | + ---------- + | | + 10 75 + | | + ------ ------ + | | | | + 10 Leaf Leaf 77 + | | + ------ ------ + | | | | +Leaf Leaf Leaf 80 + | + ------ + | | + Leaf Leaf +z7 + 50 + | + ---------- + | | + 10 75 + | | + ------ ----------- + | | | | + 10 Leaf 75 77 + | | | + ------ ------ ------ + | | | | | | +Leaf Leaf Leaf Leaf Leaf 80 + | + ------ + | | + Leaf Leaf +z8 // Uit het diktaat, blz. 73: insertTree :: a (Tree a) -> Tree a | Ord a