Day 59 — Mixed practice: Graphs

~90 minutes · Day 59 · mock day · graphs

Tonight's goal: choose the right graph model under a timer, explain it out loud, then code one DFS-flood problem and one BFS-shortest-path problem.

Tonight's protocol

Use the mock-day protocol: speak before typing, keep the timer honest, compare only after the timer.

  1. 0:00-0:04: Answer the warm-up MCQs below. No notes, no source lessons.
  2. 0:04-0:05: Open the first problem and a blank file. Solving starts at minute 5.
  3. 0:05-0:40: Solve Problem 1. First 2 minutes: explain node, edge, traversal, visited mark, and time/space complexity out loud. Then code. If stuck after 25 minutes on this problem, read only the pattern name from the menu and continue for 10 minutes.
  4. 0:40-1:15: Solve Problem 2 with the same rule: explain aloud first, code second, pattern-name-only hint after 25 stuck minutes.
  5. 1:15-1:25: Compare after the timer. For each problem, write the exact reasoning gap: wrong graph model, wrong traversal, missed visited mark, or implementation bug.
  6. 1:25-1:30: Encode one sentence per problem: the invariant that would have prevented the miss.

The problem menu

OrderProblemPattern nameTimer
1 Number of Islands grid DFS / flood a component 35 minutes
2 Word Ladder implicit graph BFS / shortest unweighted path 35 minutes

Before coding each one, say the pattern name and complexity out loud. This page is a timer, not a tutorial.

Warm-up MCQs

1. Which statement fits Number of Islands?

2. Bug: Clone Graph stores a clone after exploring neighbors. What breaks?

3. Kahn's queue empties before all courses are taken. What happened?

4. Bug: reverse flood walks from an ocean to lower neighbors. What fixes it?

5. Which first sentence makes Word Ladder a graph problem?

6. Why is a normal BFS queue not enough for Network Delay?

Self-check gate

Pass barYou explained node, edge, traversal, and complexity before both attempts; Number of Islands marks each land cell once; Word Ladder uses BFS levels for the shortest unweighted path.
Fail pathIf either timed attempt fails the pass bar, add that problem to the next revision queue with one line: WA: <root cause>. Re-solve it from a blank file before adding more graph problems.