written 7.9 years ago by | • modified 7.9 years ago |
Mumbai University > Information Technology > Sem 3 > Data structure and algorithm analysis
Marks: 3M
Year: May 2016
written 7.9 years ago by | • modified 7.9 years ago |
Mumbai University > Information Technology > Sem 3 > Data structure and algorithm analysis
Marks: 3M
Year: May 2016
written 7.9 years ago by |
RECURSION - A method of programming whereby a function directly or indirectly calls itself. Recursion is often presented as an alternative to iteration. Recursion is simply the use of a function which, as part of it's own execution code, invokes itself.
Advantage:
Recursion will be useful when same kind of job has to be continued for a finite no input or time. Eg: calculating series, finding factorial etc.
It reduces unnecessary calling of function.
Disadvantage:
A recursive program has a stack overhead.
Recursion uses more processor time.