Friday, February 28, 2014

Week 7: Recursion

     Hi, again! It is week 7, and my main task this week is to discuss about Recursion, which is a technique for solving a programming problem. Firstly, recursions usually require the function to call itself multiple times. From my understanding, recursions require the user to analyze the task by breaking it down into smaller problems until you find a ‘base case’, which helps solve the problem.  In my opinion, recursions can be very tricky and it really requires a lot of thinking in order to get the coding right. However, it is very useful in the sense that it makes the code (or solution) look simple and refined.

    After practicing recursions, I found that all recursions must have a base case, which, personally, is the most important, yet difficult in writing a recursive function. However, once you have figured out the base case of the problem, recursion becomes real easy because a recursive function is basically a function that calls itself. I found a great website that contains a brief explanation, as well as some examples of recursions. This website (http://www.openbookproject.net/thinkcs/python/english2e/ch11.html), along with the other posted readings from the course website, helped me fully understand the concept behind writing recursive functions. However, I plan to continue practice in writing recursive functions (although recursions should be avoided when programming) so that I would not forget how a recursions works.

No comments:

Post a Comment