Recursion
Recursion
An algorithmic technique where a function, in order to accomplish a task, calls itself with some part of the task. Recursion is one of the most powerful tools in a programming language, but one of the most threatening things to do as there is sometimes uncertainty about the conditions and specifications required to be known to use recursion successfully.
There are two types of recursion:
1. Direct recursion.
2. Indirect recursion.
Example of Direct Recursion
int abc ()
{
—;
abc ();
}
Example of Indirect Recursion
int abc ()
{
—;
—;
xyz ();
}
int xyz ()
{
abc ();
—;
}
Posted in Computer Science, Information Technology, Data Structure, Data Structure |
