Home
Site Map
Useful Tools
Graphing Calc

Scientific Calculator
Tools
Recursion Examples:
Recursion is something that calls itself again. Look on at the method 'recurse()' below. The bottom block is the recursive part and the top block is the 'base case.' The 'base case' is what ensures that your code will, eventually stop!
Recursion Examples:
The Tower of Hanoi
Recursion vs Regular
  public int factorial(int num)
    {
        int r = 1;
        for( int i= 1;i <= num ;i++)
           r *= i;

    return r;
    }
    
    

How would you rewrite this using recursion?

Show Answer


Practice your skills with these excercises on recursion
Sitemap