Saturday, February 8, 2014

Intro to Recursion

Recursion is one of the hardest concepts I learned so far in Computer Science. It was not hard understanding the concept itself; rather, it was hard accepting its validity when applied to computer programming. In the recursion reading, it was first described in terms of drawing fractals (for visualization), in which a hill-looking bump was drawn from a straight line. This pattern continues to grow for every straight line created by the new edge formed by the hill-looking bump. Therefore, the pattern applies the same strategy of forming the hill-looking bumps for every (new) straight edge as it used when it first started with a straight line. The first fractal from a straight line is called the base case.

    In computer science, the same idea of fractals occurs when a larger problem is broken into smaller tasks, when solving these smaller tasks use the same strategy as solving the larger tasks. The smaller tasks are carried out to complete the larger task till the base case is reached, which is the initial strategy used to solve the problem. In fact, the idea of recursion fits in well with mathematical induction. In CSC165, we had written proofs to prove a certain mathematical statement using induction, where a base case proved the statement using an example and then the statement was proved using arbitrary values, n and n+1. The use of two consecutive arbitrary values’ proof signifies the key feature about recursion, which is that the strategy used to solve the larger problem, is the same as the strategy used solve the smaller tasks needed to solve the problem.

    Although I understand recursion better now and I am able to apply it to mathematical induction, I hope that after finishing the assignment 1 and some other practices, I can understand it’s applicability in different data structures.

No comments:

Post a Comment