Write an efficient algorithm for the following problem, and describe your reasoning. Determine the Time complexity and if you cannot find any polynomial time algorithm, then give a backtracking algorithm. Problem: Tower of Hanoi with Every Tower having some Disks Input: Each of the three towers contains roughly n/3 disks. Tower A contains floor(n/3) largest disks. Tower C contains ceiling(n/3) smallest disks. Tower B contains the remaining disks. The disks at each tower are already sorted according to the typical Tower of Hanoi rule. Output: A set of moves that transfers all the n disks to C maintaining the Tower of Hanoi rule that after each move, the smaller disks at a tower will always be above the larger ones.
Write an efficient
Problem: Tower of Hanoi with Every Tower having some Disks
Input: Each of the three towers contains roughly n/3 disks. Tower A contains floor(n/3) largest disks. Tower C contains ceiling(n/3) smallest disks. Tower B contains the remaining disks. The disks at each tower are already sorted according to the typical Tower of Hanoi rule.
Output: A set of moves that transfers all the n disks to C maintaining the Tower of Hanoi rule that after each move, the smaller disks at a tower will always be above the larger ones.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images