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

    A whole blog entry on loop theory – Simply Brilliant ! 😛

  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)

    • uncivilized
      June 19, 2013 at 4:15 pm

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

    • rusa biswas
      November 15, 2013 at 3:04 pm

      thanks a lot..

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

    thz for d info……..

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

    not a satisfactory answer…… 😦

    • preetul
      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. Prashant
    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. deepak gaur
    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…
    printf(“\nmy name is sangram”);
    simple example of recrusion

  9. jayshri charpe
    March 24, 2013 at 6:46 am

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

    • hariom
      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

    • isani shekhar
      December 4, 2015 at 10:55 am

      1.recurtion is a function that partially defined by itself
      iteration uses repitation structure
      2.recurtion uses more memory than iteration
      3.recurtion makes code smaller than iteration
      4.recurtion terminated when base case is recogniged

  10. francis godfrey
    May 19, 2014 at 8:11 am

    how about the differences in terms of their algorithms

  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 )

Google+ photo

You are commenting using your Google+ 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

%d bloggers like this: