This week I spend much time figuring the step 5, namely the recursion question, in the Hanoi Puzzle. After the Monday lecture I understood the sight of solving recursion problem, and finished the three stools problem. I thought it wold be similar for the four stools, but found much harder.
By many tries, I finally finished the program but I still feel vague about the whole process. There are still many steps that I find hard to trace. However, through this assignment I have a basic framework about how to separate a recursive question into parts and divide them to base cases and recursive cases. It's just time that I need to understand it better.
In conclusion, recursive function requires a way that you focus your mind on solving only one cycle of the problem and leave the rest to the computer who can auto-run it by itself. Moreover, it's important to add condition operator to each cases, which avoids unexpected error.
No comments:
Post a Comment