Data Structures & AlgorithmsVery hardICPC regional · GATE CS top band

2 × 3 sliding puzzle with tiles 1 to 5 and one blank (shown as _). Current board: 4 1 _ / 2 5 3. Goal board: 1 2 3 / 4 5 _. A move slides a tile that is orthogonally adjacent to the blank into the blank. What is the minimum number of moves to reach the goal?

  1. A. 4
  2. B. 7
  3. C. 9
  4. D. 5

Correct answer: B. 7

A BFS over all 360 reachable boards from the goal gives 7. Counting misplaced tiles or summing Manhattan distances are lower-bound heuristics, not the exact answer.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic