Jeremiah Flaga My thoughts and experiences on programming, life, atbp.

What is Recursion?

Recursion?… Perhaps you mean Recursion!?… :smile:

“Recursion is the idea of taking a problem and reducing it to a smaller version of the same problem.”

— Prof. Eric Grimson (in Lecture 6 of MIT OCW’s course #6.0001)

Very hard… but perseverance can make it hard only, easy even

When i first encountered recursion…

“What was that again!?”

It was hard.

Then, when I encountered it again after a few months…

“Ok! I think I get it already.” :+1:

Then, again, after a few months…

“Great!! I can now solve some problems using it!”

If you have an average IQ, like me, I think it’s just normal to find recursion hard when we encounter it for the first time. (If you do not agree with me, you can assume that you have a higher IQ than me :smile:)

But I believe that after encoutering it many times, it becomes familiar and much easier to understand, just like many other things we know.

Arithmetic, for example, was very hard when we first encountered it. But today, it’s easy as 1-2-3. :smile:

If you want to learn more about recursion, Prof. Eric Grimson, in Lecture 6 of MIT OCW’s course #6.0001, shows examples on using it in solving some problems. He gave recusive solutions to

  1. multiplying numbers,
  2. determining if a string is a palindrome,
  3. the Towers of Hanoi problem, and
  4. solving for the nth Fibonacci number.