Difference Between Recursion and Iteration
Difference Between Recursion and Iteration
Infinite recursion occurs if the recursion An infinite loop occurs with iteration if
step does not reduce the problem in a the loop-condition test never becomes
manner that converges on some condition. false
(base case)
Recursion terminates when a base case is Iteration terminates when the loop-
recognized condition fails
Recursion is usually slower then iteration Iteration does not use stack so it's
due to overhead of maintaining stack faster than recursion
Recursion uses more memory than iteration Iteration consume less memory
Infinite recursion can crash the system infinite looping uses CPU
cycles repeatedly
anandbali.blogspot.in/2013/04/difference-between-recursion-and.html 1/1