Difference between Recursion and Iteration

 


Recursion Iteration
Recursion is at top-down approach. Iteration is a bottom-up approach.
When a function call itself it is called as Recursion. In Iteration, set of statements is executed repeatedly until some specified conditions is satisfied.
Recursion is based on 'base condition', execution of statement moving towards base condition. Iteration is based on initializtion, termination, updation and execution.
Recursion runs out of the memory if the base condition is not met. Iteration results in infinite loop if the termination condition is not met.
Recursion takes more space to store new sets of local variables. Iteration does not take as much space compared to recursion.
Every recursive algorithm can be converted into its iterative version. Every iteration cannot be converted to recursive version.
Recursion helps to keep our code short and simple. Iteration approach makes the code longer.
Recursion is slower than itertion due to maintenance of stack. Iteration is faster than recursion.
It is complex to implement. It is simple to implement.
Instead of making use of 'for, while, do-while' mostly in the code execution we try to call the same function again and again. The iterative function are implemented with the help of 'for, while, do-while' programming constructs.