next up previous contents
Next: Assignment (Extra Credit 200 Up: Recursion Previous: Tracing Recursion   Contents


Demystifying Recursion

At first glance, recursion is very confusion. Two things about recursion makes it confusing:

Here are the answers:

Calling recursively is really no different from calling in general. Instead of getting puzzled by the apparent mystery of recursion, one way to deal with recursion is to forget it is recursion! Just remember what the subroutine is supposed to do and what it requires to know (parameters) when you are ready to call it from anywhere. This approach (of focusing on what and not how when you invoke a subroutine) usually helps.


next up previous contents
Next: Assignment (Extra Credit 200 Up: Recursion Previous: Tracing Recursion   Contents
Tak Auyeung 2003-12-03