Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type 'a bt = Empty | Node of 'a * 'a bt * 'a bt;;
- let tt = Node(1,Node(2,Node(4,Empty,Empty),Empty),Node(3,Node(5,Empty,Node(6,Empty,Empty)),Empty));;
- let internalPath tree=
- let rec helper Node(value,tl,tr) depth=
- match Node with
- | Empty -> 0
- | Node(_,tl,tr) -> depth + helper(depth+1) tl + helper(depth+1) tr
- in helper 0 tree;;
- internalPath tt;;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement