May 2012
Intermediate to advanced
679 pages
16h 56m
English
Recursion is a programming technique. Here a function is allowed to call itself. It is most suitable in case of algorithms or data structures, which are recursive in nature. For example, binary tree is recursive data structure. If you want to visit all nodes of such a tree, recursion is very useful. However, its use in situations like Fibonacci numbers may keep your computer busy for few hours.
If you see the code for function factorial, there is only one critical line.
number * factorial(number -1);
It does the task of finding the factorial. It means that code written is small and crisp (in most of the cases). Many data structures are recursive in nature. Their handling becomes easy using recursion. The ...
Read now
Unlock full access