h
authorMart Lubbers <mart@martlubbers.net>
Tue, 24 Mar 2015 15:10:00 +0000 (16:10 +0100)
committerMart Lubbers <mart@martlubbers.net>
Tue, 24 Mar 2015 15:10:00 +0000 (16:10 +0100)
week7/mart/BinSearchTree.icl

index 92e7548..8f9f05c 100644 (file)
@@ -3,15 +3,104 @@ implementation module BinSearchTree
 import StdEnv\r
 import BinTree\r
 \r
-z0 = Leaf\r
-z1 = insertTree 50 z0\r
-z2 = insertTree 10 z1\r
-z3 = insertTree 75 z2\r
-z4 = insertTree 80 z3\r
-z5 = insertTree 77 z4\r
-z6 = insertTree 10 z5\r
-z7 = insertTree 75 z6\r
-z8 = deleteTree 50 z7\r
+\r
+z0\r
+        Leaf\r
+z1\r
+        50\r
+        |\r
+    ----------\r
+    |        |\r
+   Leaf    Leaf\r
+z2\r
+        50\r
+        |\r
+    ----------\r
+    |        |\r
+    10      Leaf\r
+    |\r
+  ------\r
+  |    | \r
+ Leaf Leaf        \r
+z3\r
+        50\r
+        |\r
+    ----------\r
+    |         |\r
+    10        75\r
+    |         |\r
+  ------    ------\r
+  |    |    |    |\r
+ Leaf Leaf Leaf Leaf        \r
+z4\r
+        50\r
+        |\r
+    ----------\r
+    |         |\r
+    10        75\r
+    |         |\r
+  ------    ------\r
+  |    |    |    |\r
+ Leaf Leaf Leaf  80\r
+                 |\r
+               ------        \r
+               |    |\r
+              Leaf Leaf\r
+z5\r
+        50\r
+        |\r
+    ----------\r
+    |         |\r
+    10        75\r
+    |         |\r
+  ------    ------\r
+  |    |    |    |\r
+ Leaf Leaf Leaf  77\r
+                 |\r
+               ------\r
+               |    |\r
+              Leaf  80\r
+                    |\r
+                  ------\r
+                  |    |\r
+                 Leaf Leaf\r
+z6\r
+        50\r
+        |\r
+    ----------\r
+    |         |\r
+    10        75\r
+    |         |\r
+  ------    ------\r
+  |    |    |    |\r
+  10  Leaf Leaf  77\r
+  |              |\r
+ ------       ------\r
+ |    |       |    |\r
+Leaf Leaf    Leaf  80\r
+                    |\r
+                  ------\r
+                  |    |\r
+                 Leaf Leaf\r
+z7\r
+        50\r
+        |\r
+    ----------\r
+    |         |\r
+    10        75\r
+    |         |\r
+  ------    -----------\r
+  |    |    |         |\r
+  10  Leaf  75        77\r
+  |         |         |\r
+ ------    ------   ------\r
+ |    |    |    |   |    |\r
+Leaf Leaf Leaf Leaf Leaf  80\r
+                            |\r
+                          ------\r
+                          |    |\r
+                         Leaf Leaf\r
+z8\r
 \r
 //  Uit het diktaat, blz. 73:\r
 insertTree :: a (Tree a) -> Tree a | Ord a\r