Home > General > What is the difference between Recursion and Iteration?

## What is the difference between Recursion and Iteration?

A recursive function works through the process of calling itself until a condition is met.
e.g. While creating fibonacci series or
calculating multiple of a number
We simply call the function repeatedly.

Iteration uses a looping control structure (while, do while, for) to repeat a section of code until a condition is met.

Frankly, Anything done in one style of looping, can be done in the other.

About these ads
Categories: General
1. January 12, 2011 at 2:56 am

A whole blog entry on loop theory – Simply Brilliant ! :P

2. April 11, 2011 at 7:53 am

A recursive function required if condition to stop the program.
Iteration works till the condition is true.

3. June 19, 2011 at 7:20 pm

Recursion is function call it self.
Iteration is one type of loop..
->two types of recursion
1)Primitive & 2) Non- primitive …
->types of iteration .
1)) loop 2) While loop 3) Do-while loop.
->>recursion is used to Stack (last in first out)

• June 19, 2013 at 4:15 pm

in types of iteration, (1) for loop should be there

• November 15, 2013 at 3:04 pm

thanks a lot..

4. January 26, 2012 at 4:47 am

thz for d info……..

5. April 17, 2012 at 7:17 am

not a satisfactory answer…… :(

• April 18, 2012 at 6:11 am

Sanjana…this is the core difference between Recursion and Iteration.
If you have anything to add in it, feel free to post

6. May 1, 2012 at 11:39 am

Recursion is a type of iteration. In recursion a rule (mathematical expressions ) defines how to iterate e.g. fib series. You need to define exite criteria in recursion. Iteration is mutable (i= 0 to 5) control structure and finite length.

7. May 10, 2012 at 5:45 pm

no stsfctry answr…guys…
simple 1 differnce its a basic differnce b/w these 2…
recrsn based on stack but itrtn not…

8. December 11, 2012 at 3:59 am

recrusion means fuction calling itself…… but iteration is faster process than recrusion…
main()
{
printf(“\nmy name is sangram”);
main();
}
simple example of recrusion

9. March 24, 2013 at 6:46 am

can anyone tell me, which is better recursion or iteration??

• August 11, 2013 at 3:39 am

Recursion is usually slower then iteration due to overhead of maintaining stack whereas iteration does not use stack so it’s faster than recursion

Recursion uses more memory than iteration

Infinite recursion can crash the system whereas infinite looping uses cpu
cycles repeatedly

Recursion makes code smaller and iteration makes code longer

10. May 19, 2014 at 8:11 am

how about the differences in terms of their algorithms

1. No trackbacks yet.