Thursday, July 7, 2011

Computer Science

Recursion 
Recursion is the process of repeating items in a self-similar way


For example 7! equals 7*6*5*4*3*2*1 


public int factorial(int n)
{
  if (n <= 1) 
    return 1;
  else
    return n * factorial(n-1);
}

Tail Recursion


Tail call Optimization