Week 4 Review
Reinforce DFS, BFS, tree constraints, and graph traversal before the final stretch.
0 of 8 problems solved
Week 4 Review
Reinforce DFS, BFS, tree constraints, and graph traversal before the final stretch.
- •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?
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.
- 1Ask whether the structure is a tree or a graph.
- 2If it is a tree, ask whether you want depth-first or level-order behavior.
- 3If it is a graph, ask how you will track visited nodes.
- 4If dependencies appear, ask whether cycle detection is the real goal.
Jumping straight into recursion or queues without first identifying the traversal goal usually makes tree and graph code feel much harder than it is.