Most tree problems follow a pattern: solve for left subtree, solve for right subtree, combine results. The recursive structure mirrors the tree structure. When you see a tree problem, ask:
What's the base case? (Usually: null node)
If I had answers for left and right subtrees, how would I combine them?
What information do I need to pass down? What do I return up? This thinking applies to:
- Computing tree properties (height, size, diameter)
- Checking tree properties (balanced, symmetric)
- Modifying tree structure (invert, flatten)
- Finding paths and values
Practice this pattern until it becomes automatic.