Wednesday, 5 March 2014

Recursion

Recursion is when a function, under certain circumstances, calls itself to make new evaluations based on the variables obtained during the running of the function. Initially, I had the impression that this was similar to nested while loops, but it seems that while those progress in a relatively straightforward manner, recursion dances forwards and backwards before reaching the finish line. It makes me feel as though I was watching a science fiction movie about time-travel with mind boggling timelines and paradoxes.
The short assignments were simple to understand. It doesn't take much brainpower to understand the recursion going on in finding the number of nested objects in a list, but I feel that there was an enormous gap between those simple tasks to the cheese tower assignment. I've been told to not think about the underlying processing of the functions too much, but I believe I did anyway and ended up confusing myself instead. I couldn't accept that if it works, it works. Maybe it's a good trait to have, but not when it costs me marks. I'll look around for more recursion problems to do, it should make sense eventually, just like math equations.
I hate to be afraid of recursion. Maybe psychologists should classify recursionophobia as a legitimate condition.

1 comment:

  1. Great to know that you don't accept a solution 'as is'. But recursion is hard to visualise and change your perspective to the simple base case/recursion case can be helpful.

    ReplyDelete