Back to Roadmap
Week 4Day 28 of 35

Week 4 Review

Reinforce DFS, BFS, tree constraints, and graph traversal before the final stretch.

Day Progress0%

0 of 8 problems solved

Pattern Focus

Week 4 Review

Reinforce DFS, BFS, tree constraints, and graph traversal before the final stretch.

Pattern Checklist
  • Can I tell DFS apart from BFS quickly?
  • Do I remember to track visited nodes in graph problems?
  • Can I explain whether the problem wants depth, breadth, or cycle detection?
🧭New to DSA? Start here 🧠

Week four is where tree and graph problems stop looking random. Trees often want DFS or BFS. Graphs usually want traversal plus visited tracking. The main job on review day is to ask whether the structure branches like a tree, connects like a graph, or needs level-by-level processing like BFS. Once you name that shape, the implementation becomes much less mysterious.

The biggest speed boost is recognizing whether you want depth, breadth, or cycle detection before you write anything.

How to think about it
  1. 1Ask whether the structure is a tree or a graph.
  2. 2If it is a tree, ask whether you want depth-first or level-order behavior.
  3. 3If it is a graph, ask how you will track visited nodes.
  4. 4If dependencies appear, ask whether cycle detection is the real goal.
🚧Common Mistake

Jumping straight into recursion or queues without first identifying the traversal goal usually makes tree and graph code feel much harder than it is.

Problems

Review: Maximum Depth of Binary Tree

easy

Review: Invert Binary Tree

easy

Review: Same Tree

easy

Review: Subtree of Another Tree

medium

Review: Binary Tree Level Order Traversal

medium

Review: Validate Binary Search Tree

medium

Review: Number of Islands

medium

Review: Course Schedule

medium