Wednesday, February 4, 2015

Week5-Tracing Recursion






Recursion is a way of finding solutions by breaking down the solution into smaller parts and build up the final solution by the smaller parts. In other words, it is the process of repeating items in a self-similar way.

When tracing most recursive functions, there is winding and unwinding part. The "winding" part occurs as the recursion heads to the base case, and the "unwinding" part occurs when the recursion returns back to the original call. 

One thing that is important to realize is that analyzing a few base cases can help give a better understanding of the big image.  

I understand recursion functions as a method to separate the unwinding functions in to multiple small winding parts.  And since the winding part to be much easier, the question becomes solvable. Therefore, the most important idea behind recursion to me is to repeat the same task in various depths. 

Also, I found that recursion is just like while loop and for loop because they are all about repeating a calculation for multiple time. Here is an example of the three. 





No comments:

Post a Comment