Recursion is the process in which a function calls itself. Generally, iterative programs are slower than corresponding iterative versions of the same program but recursion has found its use due to the fact that sometimes, it is easier to develop recursive version of the program than to develop a iterative version of the same program. The general condition for the recursive program is to have a condition that should fail at some point in the program and at that point, the program needs to traverse back to generate the final answer. Without this condition, your program may fall into an infinite loop, so, the program will never stop unless the stack of method calls is overflowed.
Showing posts with label REcursice Program. Show all posts
Showing posts with label REcursice Program. Show all posts
Subscribe to:
Posts (Atom)