Showing posts with label Algorithm. Show all posts
Showing posts with label Algorithm. Show all posts

Tuesday, November 10, 2015

Recursion Algorithm

In computer science, Recursion is a function that calls itself. 

Recursive function has two main points. one is the stopping point and 
second is calling itself until problem is solved.   

This is the most common example of returning a factorial of given input parameter 
by recursive function.



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