diff options
Diffstat (limited to 'week7')
-rw-r--r-- | week7/mart/BinSearchTree.icl | 107 |
1 files changed, 98 insertions, 9 deletions
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
|