Advertisement
tinyevil

Untitled

Nov 29th, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. :| Tree
  2. Leaf(Natural)
  3. Node(left:Tree, right:Tree)
  4.  
  5. :| BalancedTree : Tree
  6. Leaf(_)
  7. Node(BalancedTree left, BalancedTree right) | height left == height right
  8.  
  9. is_balanced_tree (Leaf _) = true
  10. 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