Jumat, 28 Oktober 2016

What is recursion in Programming

A function invoking itself is known as recursion. Recursion is an alternative to iteration. Recursion is very close to mathematical way of solving a given problem.   Advantages of recursion are, it is straight forward and easy. Disadvantage of recursion is, it occupies more memory on the stack when compared to iteration.   Note: Remember to write an exit condition while using recursion. If there is no exit condition, then the function will call itself infinitely.   Consider the following program which calculates the factorial of a number using recursion: 1 2 3 4 5 6 7 8 9 10

The post What is recursion in Programming appeared first on Coding Security.


What is recursion in Programming
read more

Tidak ada komentar:

Posting Komentar