For Binary Search Trees

  • A node is balanced if its children’s heights are within 1 of each other
  • A tree is balanced if all of its nodes are balanced

Note

  • Leaf nodes are always balanced
  • Missing children have a height of -1

A balanced tree

An imbalanced tree