Sunday, February 9, 2014

Week 5 Learning Recursion

       Continue from last week's lectures, recursion is still the top topic in this week. I did more practice on tracing recursion, and learned how to code recursions. When professor talked about tracing during lectures, he also told us how to be lazy. Never trace something we know what its output is. It will save us plenty of time.
       In lectures, an example about coding for recursion is the Tower of Hanoi. It was quite easy to code it, because I knew how to play the game, and professor gave the step-to-step instruction on it. Besides, professor finished the base case for this recursion. It makes the lecture seems really easy.
       However, I got a lot problems when I wrote the code for the recursion in assignment one, since nobody gave me the base case or general case or step-to-step instructions about it this time. I failed couple times, because I forgot to write code for the base case. So my recursion just kept repeating until I found this mistake out.

       I think I would still take a long time before I can ace recursion in test.

No comments:

Post a Comment