Sunday, 2 March 2014

Recursion

def week_seven(blog):
"""We've finally arrived to what is constantly described as the core of CSC148. While the subject is initially bewildering, it is actually relatively simple. Basically, recursion is when a function calls on itself, which is recursion when a function calls on itself, which is recursion is when a function calls on itself- you get the point. What makes recursion so brilliant is what it allows you to do. Without recursion, programming would be significantly more challenging and less efficient. Data trees, for example, are made possible by recursion. Quite frankly, writing about this topic is particularly daunting because of its scope. Instead, I'll focus on my own "journey", if you may, as I learned about this subject.

Way back in high school, I did some programming competitions. My coding was pretty basic, but I still enjoyed doing them. I still remember looking at the solutions, and coming across "simple recursion" as the descriptions. Based on my knowledge at the time, I had no idea what this mysterious "recursion" was. Though, to be fair, I didn't know what a function was either. Now that I'm more knowledgeable about the subject, all those old questions seem so much more simple.

When I learned about recursion for the first time in this class, I was surprised at how simple it was. I always wondered "if a function calls on itself, when will it ever end?". Well, the use of if statements makes the answer quite simple. Though it took a moment to wrap my head around the concept, after this point (and my first recursion tutorial), I felt as though I knew "how to recursion". I practiced tracing recursive functions a little bit in order to fully grasp the concept, and I feel like I figured it out (well, at least I did until I got my marks for the first question of the term test). From there I moved on to trying to implement recursive functions into my code. At the most basic level it was quite simple, however as I described in my last entry, implementing it into tour.py of A1 was a little mind boggling. To be honest I'm still a little confused how that ended up working out, though I'm not complaining.

From there I learned more and more about the usefulness of recursion. So many things were rendered simpler through it's use. I found data trees to be fascinating, and the use of recursion in order to establish and traverse through them was also very interesting. Ultimately, I feel like I still know nothing of the true power of recursion, though I am looking forward to learning more about it!"""

    if (blog.read()):
        return "Thanks for reading :)"
    else:
        return week_seven(blog)


No comments:

Post a Comment