Sunday, February 8, 2015

Week 5: Tracing Recursions

When I first started learning recursion in high school, we directly started learning from the base call and recursive call; we didn't do any recursion tracing exercises. When we first started to do recursion tracing exercises I felt that it was really weird and personally I didn't like the process of tracing recursion. Even though this is the approach in how we think about recursion, I had difficulty writing out the exact steps of recursion.

For example if there was a recursive function like count(x) that took a nested list as input and flattens it into a single list. I know how the recursive idea works, but I'm not used to tracing it and writing out what happens at each element in the list. I think that after you get the general idea of how recursion works, tracing the functions is not necessary. But, it would still be useful for some complex functions that are difficult to understand.

No comments:

Post a Comment