Thursday, February 20, 2014

Week 7 Recursion

Week 7 Recursion


Recursion was the main focus what we have been studying for the past two weeks. Recursion is mainly using the solution from the smaller instance of the problems to solve the problem as a whole using the same process until the program gets to some point. The formal explanation would be that recursion is functions that call themselves within their definitions.It is one of the most important idea in computer science that help to build the models of functions. It is a circular idea of solving problems through looping over the same strategy and solve the small instances of the problem. That is to say, break down the questions into smaller part that is easier to calculate; after that, combine all the answers together and stop at some given point. It is an extremely helpful method that calls itself repeatedly within the function. Tree models are the best examples for recursion which runs recursively. Similarly, the Fibonacci numbers in math uses the same method as recursion in programming. It is quite obvious that all the recursion look like tree figures, including the examples of tree models, turtle and Fibonacci numbers. One of the most important point in recursion is to find the smallest instance to start the recursion, and the other one is to find an end point for it to stop recursion. Sometimes, it is hard to find the start point, yet as long as we can find out the start point, then the whole process would be straight forward. 

No comments:

Post a Comment