Monday, 30 March 2015

Week 11 Recursion

    In this semester, we learned pretty much about recursion. It used to be a completely new concept to me, and it was even hard to understand at the beginning, but after doing much practice, I now find it concise and, even beautiful!
    I revisited my impression about recursion which I wrote a few weeks ago. It turns out that I actually knew the definition well at that time. As I wrote in the blog, recursion is a method of solving problems that involves breaking a problem down into smaller and smaller subproblems until you get to a small enough problem that it can be solved trivially. Usually recursion involves a function calling itself. 
     However, now I'm starting to get used to it more and think about whether it'll be better to use recursion in the code. Instead of only memorizing the definition, I find it more practical in some coding work. In fact, recursion can just solve the problem in much fewer codes rather than writing several lines of 'for loop' and 'while loop', which is absolutely its advantage. While it may not seem like much on the surface, recursion allows us to write elegant solutions to problems that may otherwise be very difficult to program. And recursion is proved to be super effective in the class such as Tree and BTNode which we did this semester. It's also a crucial method in A3 that we're working on now.

No comments:

Post a Comment