Solve the previous Towers of Hanoi puzzle iteratively instead of recursively by using the following algorithm. Beginning with pole A and moving from pole to pole in the order pole A, pole C, pole B,...


Solve the previous Towers of Hanoi puzzle iteratively instead of recursively by using the following algorithm. Beginning with pole A and moving from pole to pole in the order pole A, pole C, pole B, pole A, and so on, make at most one move per pole according to the following rules:


• Move the topmost disk from a pole to the next possible pole in the specified order. Remember that  you cannot place a disk on top of a smaller one.


• If the disk that you are about to move is the smallest of all the disks and you just moved it to the present pole, do not move it. Instead, consider the next pole.


This algorithm should make the same moves as the recursive algorithm given in the previous project. Take note of the differences in logic that arise from not using recursion.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here