Q2 — SEARCH FOR OPTIMAL SOLUTION

DFID is provably optimal only because every iteration re-inspects nodes it closed in earlier iterations.

The Question

#QuestionOfficial answer
2Under what cases does Depth First Iterative Deepening (DFID) guarantee an optimal solution?C

The Topic in 60 Seconds

DFID runs a depth-limited DFS with limit 1,2,3,…1, 2, 3, \dots Each iteration throws away all bookkeeping from the previous one and starts from scratch. With unit edge costs, the iteration with limit dd visits every node at depth ≤d\le d as if it were brand new, so the first iteration that reaches the goal reaches it at minimum depth — exactly what BFS would return, at DFS memory cost.

Deep-dive: browse the Concepts section for iterative deepening.

Solutions

2 — Under what cases does Depth First Iterative Deepening (DFID) guarantee an optimal solution?

Options:

OptionVerdict
A — When it inspects only new nodesFails: skipping previously seen nodes means an early iteration could close a node on a shallow path and later iterations would refuse to walk through it
B — When it inspects new as well as open nodesNot the guarantee: OPEN-only reuse still lets stale frontier entries block rediscovery; DFID keeps no cross-iteration frontier at all
C — When it inspects new as well as closed nodesCorrect — see below
D — None of theseWrong: C is exactly the case

Answer: C

Why C is right

The optimality argument lives in the redundant work. On iteration with limit dd, DFID re-generates and re-expands every node closed by iterations 1…d−11 \dots d-1 — nothing is remembered. That is precisely what makes it safe:

  1. Suppose a goal gg sits at depth kk (fewest moves, unit costs).
  2. Iterations 1…k−11 \dots k-1 never reach depth kk, so they cannot report gg.
  3. Iteration kk explores all paths of length ≤k\le k from scratch — closed-node history from earlier rounds is discarded, so nothing blocks reaching gg via its shortest route.
  4. Hence the first success happens at depth exactly kk: shortest path guaranteed.

If DFID did respect old CLOSED nodes (option A's spirit inverted / a global closed list), a node first closed at depth jj in a small iteration would never be re-expanded, and a strictly shorter route found only at limit d>jd > j could be missed — optimality breaks. DFID's apparent wastefulness (re-expanding closed nodes over and over) is not a bug; it is the optimality proof.

Tricks & Tips

Answers: 2 C