DSA Master › Topic 11

Binary Trees

Nearly every tree problem follows one recursive question: "What does each child need to return so I can answer at this node?" Postorder DFS (children first) handles height, diameter and path sums. BFS with a queue handles anything level by level.

Concepts

How to recognise it

Common pitfalls

Problems

  1. Maximum Depth of Binary Tree (Easy)
  2. Invert Binary Tree (Easy)
  3. Same Tree (Easy)
  4. Balanced Binary Tree (Easy)
  5. Diameter of Binary Tree (Easy)
  6. Binary Tree Level Order Traversal (Medium)
  7. Binary Tree Right Side View (Medium)
  8. Lowest Common Ancestor of a Binary Tree (Medium)
  9. Path Sum (Easy)
  10. Path Sum II (Medium)
  11. Construct Binary Tree from Preorder and Inorder Traversal (Medium)
  12. Serialize and Deserialize Binary Tree (Hard)
  13. Binary Tree Maximum Path Sum (Hard)
  14. Vertical Order Traversal of a Binary Tree (Hard)