The week before an assignment is always crazy. I never seem to learn my lesson. This was the first assignment for Computer Science that I have attempted without a partner, and I realize just how much "two heads are better than one" holds true.
Recursion is something we must understand at this point. It's a shame I still don't understand it. I thought I did, because seeing Danny do it in class made it seem easy. We also did it in lab, where I got a better understanding of it but I still fail to wrap my head around it all.
What I do understand is that there must be a base case -- a base case is a conditional statement that will stop a recursive function from running and causing errors.Otherwise, the function will run, calling itself within itself, and return something each time so that the function can be called again, using the returned item as a parameter. This goes until the base case is fulfilled.
What I do not understand is how a function calls itself. To me, recursive functions look like undefined variables, where they are referenced before they are defined. Perhaps I should trace functions in my free time, especially since there is an important recursive function to be written at the end of A1.
No comments:
Post a Comment