How Recursion Works

44

Video is ready, Click Here to View ×

c++ tutorial

Share.

About Author

44 Comments

  1. The absolute best explanation!!!!! I know this isn't an easy one to explain but making it clear that the stack had to do with it. I'm not going to lie… colors and a little stick figure really helps. lol Thank you!!!

  2. What happens here for this recursive condition?

    a = 10, b = 8, n = 6:

    int rFibNum(int a, int b, int n) {

    if (n == 1) {
    return a;
    }
    else if (n == 2) {
    return b;
    }
    else {
    return rFibNum(a, b, n – 1) + rFibNum(a, b, n – 2);
    }
    }

Leave A Reply