What I didn't know about recursion was that it is a extremely repetitive process. I noticed this after I can it through the python visualizer and noticed the amount of calls to line 2 and 4 that were made. Basically every time the function called itself, python had to determine whether the n-1 was equal to 1 or not. In addition, I gave myself a simple example and traced the code by hand when n = 4.
Summarizing my thoughts on tracing recursion, I found that I must first locate the recursive function and then use this code and apply it to each element of the object. Then making my way to unravel each of the calls to the lowest element.
During the lab, I found that my understanding of recursion made it easy to do the lab material and quiz as I only thought of the questions presented as an onion that has multiple layers, slowly unwrapping until I reached the core.
I also found this video extremely helpful with my understanding of recursion:
https://www.youtube.com/watch?v=s12IdMeVpw0
No comments:
Post a Comment