TreesExplained
Balanced Binary Tree
Check at every node that child heights differ by at most 1.
Time
O(n)
Extra space
O(h)
Use it for
Validating AVL-style balance.
Check at every node that child heights differ by at most 1.
Time
O(n)
Extra space
O(h)
Use it for
Validating AVL-style balance.