Skip to content

09. Trees

🧠 Tree Strategy

  1. Recursion is King: 90% of tree problems are solved by trusting the recursive call on left and right.
  2. Traversals:
    • Inorder (Left-Root-Right): Sorted order for BST.
    • Preorder (Root-Left-Right): Good for cloning/serializing.
    • Postorder (Left-Right-Root): Good for deleting or bottom-up calculation (height).
  3. BST Property: Max of Left Subtree < Root < Min of Right Subtree.

🟢 Traversals & Views

🟡 Construction & Properties

🟠 LCA, Paths & Distances

🔴 Binary Search Trees (BST)

🟣 Tries (Prefix Trees)


📚 Other Problems