Sunday, February 2, 2014

Recursion

Recursion was the word of the week. Similar to mathematical induction, recursion is used when some base case is built upon to solve a problem. It is a simple concept to grasp.

Take for example a lecture hall filled with students. Although the number of students varies depending on the class, the way each assignment average changes the same way. If one student hands in his assignments then he will get marks for it and thus the course average will change. Taking that first student as our “base case” if we assume that the case holds true for some number of students, lets call this n, then through mathematical induction we can assume that it holds for n + 1 number of students. This means that it doesn’t matter how many students there is but when an assignment is handed in it affects the overall average in the same manner.

Although I am familiar with this idea of mathematical induction applying it for recursive problems in computer science is a bit more challenging. Coding for the base case is straightforward but I find it challenging to expand my knowledge and have it apply for all other cases. With the center of assignment one revolving around recursion, I am slightly worried. On the other hand, I accept the challenge that assignment one presents. As such, I hope to master recursion after the completion of this assignment.

No comments:

Post a Comment