Wednesday 22 January 2014

Week 2: Recursion

This week's class we learnt about the concept of recursion.
It's pretty interesting.
Essentially recursion is a function that calls itself in order to complete whatever task you desire.

In order to use recursion there has to be:

  • a pattern or specific sequence that repeats it self.
  • a base case so the computer knows where to start.
  • a function that does something

The concept of recursion is not too difficult to understand, but its not as simple as it looks.
This stuff gets pretty confusing when you have some whacky sequence. 

Creating a recursive function ezpz once you get the base case, luckily if you're good with recognizing patterns you can get that base case. Unfortunately I am not that person.

No comments:

Post a Comment