Monday 3 February 2014

Week 4: More Recursion

Okay, so we're back to recursion this week.
In case you forgot recursion is a process computer scientists use to make their lives easier.
Essentially recursion calls upon the same function over and over again until their problem is solved. Recursion is used when theres some sort of pattern or sequence.
Recursion requires a base case and the sequence you're trying to solve.
Trying to do recursion without a base case is a big no-no...
If you do this you are a wicked person.
You will send the program to recursive hell if there is no base case.
Essentially the function will keep calling itself over and over again until the program cries..."maximum recursion depth reached". What kind of monster could do such a thing to a computer???!?

Anyway, if you find yourself repeating yourself, use recursion and call it a day.