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.

Categories: General
  1. Rohit
    January 12, 2011 at 2:56 am | #1

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

  2. April 11, 2011 at 7:53 am | #2

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

    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)

  4. shwetha
    January 26, 2012 at 4:47 am | #4

    thz for d info……..

  5. sanjana
    April 17, 2012 at 7:17 am | #5

    not a satisfactory answer…… :(

    • preetul
      April 18, 2012 at 6:11 am | #6

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

  6. Prashant
    May 1, 2012 at 11:39 am | #7

    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. deepak gaur
    May 10, 2012 at 5:45 pm | #8

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

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.