Posted on:

17 Aug 2022

0

the order of (ACB, n-1), (ABC, 1), (BAC, n-1) in the else statement?

Hi,

I would like to clarify why the order of the arguments inside the parentheses when we pass the function towers_of_hanoi in the else statement is source, auxillary, destination, then the disk (either n-1 or 1). I can understand what is happening in the function, but what I do not understand is the order of source, auxillary, and destination inside the parenthesis. why does the auxillary rod go in the middle? why could we not code it as source, destination, then auxilary?? for example, the first argument after the else statement could have been:

towers_of_hanoi(A,B, C, n-1)

could it also have been:

towers_of_hanoi(n-1, A,B, C)?



I hope my question is clear?

thank you in advance for your help.








0 answers ( 0 marked as helpful)

Submit an answer