Posted on:

15 Mar 2021


How do the numbers move between lists in the given code for Towers of Hanoi?

I've carefully studied the Towers of Hanoi code and the explanation and cannot understand why this code works.  The explanation Giles gives for the code is very brief, and lacks detail.  I can't understand how anything moves from one list to another with that code.  He said "the order of the lists is important" but doesn't say why or how numbers move between lists with each recursion.  Why does changing the order of the lists move numbers between lists?

I reviewed the recursion lesson, as Giles suggested, but that did not help to explain what is happening in the Towers of Hanoi recursion.

How do the numbers move from one list to another?
If A = [3, 2, 1], please explain each step, from the first recursion to the seventh recursion.

0 answers ( 0 marked as helpful)

Submit an answer