My impressions of tracing recursion:
To begin off our lecture on recursion, the istructor provided us with a problem involving a list within a list within a list... At first this preblem seemed completely bizarre and I had no idea where to even begin. We then began working on a problem in class, which essentially returned the the greaters number in the list. We first began by feeding the function something that was not a list (int) and observed what the function gave back, then moving to lists of depth 1, all the way to lists of depth 3. I found, as we went along, that while increasing the dephth of the list, we didn't really need to think about how to calculate anything new, but rather we just have to use exactly what we implemented before that. So in other words, recursion was just basically applying the same base computation multiple times in order to solve a more complex arrangement. Being a math major, I find that recursion in kind of like a puzzle in which you are always trying to see where to place elements of a list, and when a function needs to call itself. I really enjoyed learned about recursion (my favourite topic of the course so far), and I think it is very useful in that it make problems that originally seem very complicted, more simple by breaking them down into smaller steps.
No comments:
Post a Comment