Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :| Tree
- Leaf(Natural)
- Node(left:Tree, right:Tree)
- :| BalancedTree : Tree
- Leaf(_)
- Node(BalancedTree left, BalancedTree right) | height left == height right
- is_balanced_tree (Leaf _) = true
- is_balanced_tree (Node left right) = is_balanced_tree left && is_balanced_tree right && height left == height right
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement