Recursion is a repetitive process in which an algorithm or function calls itself. C & C++ both support recursive programming.
1. There must be certain values, called based values, used for termination of program or definition of function. At these base values the function / algorithm does not call itself.
2. Each time function / program call itself, it must be closer to the base condition.
Some mathematical functions and problems (a few to mention) that can be solved recursively are
· Factorial
· Fibonacci Number
·
· Towers of
· Binary Search
No comments:
Post a Comment