Lecture 13 Ierg 4120
Lecture 13 Ierg 4120
Lecture 13 Ierg 4120
Kehuan Zhang ©
Definition of Trees
type 'a tree = Leaf of 'a | Node of 'a * 'a tree * 'a tree;;
let t = Node (4, Node (2, Node (1, Leaf 90, Leaf 100),
Node (3, Leaf 20 , Leaf 30)),
Node (5, Node (6, Leaf 40, Leaf 50),
Node (7, Leaf 70, Leaf 60)));;
2 5
1 3 6 7
90 100 20 30 40 50 70 60