summaryrefslogtreecommitdiff
path: root/week7/mart/BinSearchTree.icl
diff options
context:
space:
mode:
authorMart Lubbers2015-03-24 16:10:00 +0100
committerMart Lubbers2015-03-24 16:10:00 +0100
commit6e732075e3861dd74917600a15e300ec5cf556aa (patch)
treee13891433d5420ba0b1a62894e4bc551a5778306 /week7/mart/BinSearchTree.icl
parentinitial week 7 commit (diff)
h
Diffstat (limited to 'week7/mart/BinSearchTree.icl')
-rw-r--r--week7/mart/BinSearchTree.icl107
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