An in-depth study of recursion

Review of the recursion concept:

  • Recursion = defining "something" in terms of itself

  • Example:

        Non-recursive definition of factorial of n:
      
            n! = n*(n-1)*(n-2)*...*2*1          
      
        Recursive definition of factorial of n:
      
            n! = n*(n-1)! 
            0! = 1
      

  • A recursive definition must have at least one base case to terminate the recursive use of the definition