Sunday, March 2, 2014

Recursion

1 . Introduction
Recursive algorithm is an algorithm calls itself indirectly or directly . In computer programming, a recursive algorithm to solve some of the problems is very effective .  It tends to make the description of the algorithm  simple and easy to understand . Hence, when it is difficult to solve the problem by using non-recursive method , try using a recursive method may give you unexpected surprise.

2 . Features 
Recursive programs during execution always call their ownand every time they calling itself,  the scale are usually narrowed. And when the scale of the problem is reduced a certain value, for which the program can directly give answers instead of recursively calling itself .Therefore each recursive call is conditional (the condition is often considered as the size of the scale), and there is close relationship between adjacent two calls (usually the output of the previous one serves as the input of the latter one). Additionally, what I think is the most important thing in recursive programming is that when using a recursive strategy, we must have a clear end , also known as recursive exports.

3.Application
In my opinion, recursive algorithm is generally used to solve three problems : 
1) The data is defined b recursion 
    example: Fibonacci function
2) The algorithm for solving a problem is a recursion
    example: Tower of Hanoi
3) structure of data is based on a recursive definition
    example: Binary tree

3 comments:

  1. I think recursion is so useful. We sometimes do not need to know what the function exactly do. Just write down the base cases and get the final result based on our assumption that we have done the function.

    ReplyDelete
  2. i think your interpretation of recursion is very thoughtful. now i have a clearer image of recursion

    ReplyDelete
  3. Recursion really confused me at first.

    ReplyDelete