Infolinks In Text Ads

Recursion

Recursion in mathematics and computer science, is a method of defining functions in
which the function being defined is called within its own definition.
In simple words the term recursion is used whenever a function is called within itself.


Consider the following example.
int function (int n)
{
If (n==0) // Base or test case
return;
else
return n*function(n-1)
}

Some important points about recursion are listed below.
1. The test case is the base of elimination of recursion.
2. Looping is discouraged in a recursion function.
3. Recursion is limited to a specific number of problems due to limits of stack
memory and complexity. That is a recursion function should not be too complex
as backward tracing would become too much complex.

Newer Post Older Post

Leave a Reply

Powered by Blogger.