Sunday, 8 February 2015

Tracing Recursion

                Last week I talked about how interesting recursion was to me, and since then I have read the SLOGs of many other students who are also very interested in the topic. Among the SLOGs I read was Jesse’s who in his post entitled “Wrapping my head around recursion” took an amusing baked dessert look on recursion. In week four we learned how to properly trace a recursive function so that we can understand how a function behaves with different inputs and eventually prove that any input will work with the function (with certain conditions). This is done by starting with the simplest (or shallowest) input you could input and tracing deeper and deeper calls (one depth at a time). In the processes you do not have to rewrite a depth you have already tried as you have already proved that the function works with that depth.


                I find this method of tracing a recursive function very helpful as it can be used to trace most recursive functions no matter the complexity. Some students seem to find it pointless with the function we have been practising with as you can figure out most of them in your head without this method, but that is not the point of us learning this method. This method is meant to help us with any recursive function that we may come across and for that I find it extremely helpful.

No comments:

Post a Comment