Last answered:

29 Apr 2024

Posted on:

26 Apr 2024


Multiple recursion helpful info - Tower of Hanoi

Hi everyone,

after some time searching online for answers on how multiple recursion functions are called, here's what helped me:

First I used the function explained in the youtube video from the same teacher linked in this discussion (the one in the course works as well, I just worked on this because it seemed more linear):

Then understanding the decision tree -> since our function calls itself twice inside it, each time it's called the tree splits in 2: 

Then we need to clear out what is happening to the variables locally during the calls, since they move around quite a lot:

Hope that helps, happy coding!

1 answers ( 0 marked as helpful)
Posted on:

29 Apr 2024


Hey Jessica,

This looks great! Amazing work! Thanks so much for sharing with the other people taking the course.

Visualizing recursive calls as a decision tree is an excellent method to comprehend the branching nature of recursion, especially in multiple recursion scenarios. Each node in the tree represents a function call, and each branch represents a new recursive call initiated by the current function call. This visualization helps in understanding how the recursive calls expand exponentially.



Submit an answer