Which of the following is not a backtracking algorithm?

2018

Which of the following is not a backtracking algorithm?

  1. A.

    Knight tour problem

  2. B.

    N-queen problem

  3. C.

    Towers of Hanoi

  4. D.

    M-coloring problem

Attempted by 964 students.

Show answer & explanation

Correct answer: C

Answer: Towers of Hanoi is not a backtracking algorithm.

  • Knight tour: This is solved by exploring possible knight moves recursively and backtracking when a move leads to a dead end; it is a search with branching and undoing of choices.

  • N-queen: Place queens one by one and backtrack whenever a placement causes a conflict; that trial-and-error with undoing is backtracking.

  • M-coloring: Assign colors to vertices and backtrack on conflicts to try alternative colorings; this is also a classic backtracking approach.

  • Towers of Hanoi: Solved using a fixed recursive procedure that follows a specific move pattern. It does not involve exploring multiple alternative choices and undoing them in the sense of backtracking, so it is categorized as a recursion problem rather than a backtracking search.

Key idea: Backtracking involves branching over alternative choices and undoing (backtracking) when a branch fails; recursion can be used without backtracking when the sequence of recursive calls is deterministic.

Explore the full course: Up Lt Grade Assistant Teacher 2025