My fellow programmers,
Welcome back for the latest week's review in CSC148. The major topic in class this week was Recursion. Recursion is the process whereby a complex problem is solved by breaking the problem down into simpler problems, until a base case is reached. Solving the base case allows us to reconstruct all the solved subproblems, to finally solve the bigger problem, initially presented. From the definition of recursion you can already notice that it seems like a great tool to use to solve a lot of complex problems.
When Dan first started lecturing about recursion I was shocked that we never learned about this in CSC108, because seriously, I feel like this could have been a great way to think through a lot of the problems we faced last term. However, as I pondered about the clever algorithm I realized that I have been using it for a long time, but on a broader scale. Recursion is a great tool when solving problems involving critical thinking, because when put in a unfamiliar situation we must relate the big picture of the problem to smaller, more familiar problems. After solving these simple, and familiar problems, we can put their solutions together to finally solve the original problem that was presented to us.
Anyways, going back to CSC148, I'm facing a problem understanding a minor detail of recursion. I don't understand how we could call a function within the implantation of that particular function. It seems like this is very important when solving problems using recursion, as we design a function to handle a complex problem by calling it within its self to handle the base case of that problem. I thought this whole time that a function couldn't be called until the function definition was complete. However, hopefully after using recursion more often I'll be able to fully understand how this type of code is compiled, thus I'm excited to use recursion in next week's lab and when solving other computer programming problems.
No comments:
Post a Comment