## 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.

Categories: General

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

A recursive function required if condition to stop the program.

Iteration works till the condition is true.

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)

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

thanks a lot..

thz for d info……..

not a satisfactory answer…… :(

Sanjana…this is the core difference between Recursion and Iteration.

If you have anything to add in it, feel free to post

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.

no stsfctry answr…guys…

simple 1 differnce its a basic differnce b/w these 2…

recrsn based on stack but itrtn not…

recrusion means fuction calling itself…… but iteration is faster process than recrusion…

main()

{

printf(“\nmy name is sangram”);

main();

}

simple example of recrusion

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

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

how about the differences in terms of their algorithms