Our introduction to the concept of recursion was something of a rude awakening at first. My initial visualization of the concept involved looking at the base case and the higher-order cases in an isolation of sorts. While I realized perhaps that the second level of recursion may function as it was supposed to, it took me a span of time before I could even realize how recursive code did anything at all.
Looking at higher order cases, it was not until I realized that each level delved deeper and deeper and eventually back to a base (or baser) case that I understood. Each level would then return its own result into the previous call, creating a brilliant structure that simply could not possibly have been mirrored by iteration. However, on visiting the Professor during office hours, he encouraged me immediately not to look at recursive issues in this way, noting "You're trying to look at every stage of the problem, when that's the computer's job" and encouraging me simply to develop a case for n+1 that I was convinced worked. Still, I had trouble comprehending our assignments in Lab this week as I was still struggling to some extent to understand how the entire concept fit together.
On the bright side, even without full understanding, I was already quite able to see how this constituted an improvement over our former iterative design. (A suspicion that has most certainly been confirmed as of Week 8, when we were encouraged to try code we would now normally use recursion with, but using an iterative design. It proved complex to say the least)
No comments:
Post a Comment