Sunday, 2 March 2014

Recursion

Recently, I read a tutorial on recursion, yet there was something special about how the author explained it. He used zombies and humans to try to explain it. The idea was that zombies bite humans and those humans turn into zombies which bite other humans. Specifically, this was a neat chain reaction. That is all recursion is. A chain reaction that occurs and keeps going until it stops and then the end result is usually what matters. In the zombie case, it keeps happening until all the humans turn into zombies.

I think recursion is a topic that everyone will fully appreciate as we continue through the course. The depth of it's usage and usefulness is tremendous. It is very useful in algorithms that feature mathematical calculations that are based on the result of the previous calculation. For example, the Fibonacci sequence can be expressed as an algorithm. Even something very simple such as manually calculating factorials. 

We, as a class make recursive calls through list comprehensions almost exclusively. I have yet to see an example on the csc148 website nor the examples in class that feature recursive calls that are not in the return statement. Personally, I have trouble understanding the list comprehensions because I am used to writing multiple lines of code rather than compiling it all together in one big return statement. But that is just my opinion.

I definitely think that more practice with recursion would benefit me even though we do not go over the topic much anymore because of how useful and practical it is in creating self propelled projects.