Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Iteration vs. Recursion#

Sumit Rawal answered on May 16, 2023 Popularity 8/10 Helpfulness 4/10

Contents


More Related Answers

  • a better way of recursion
  • Why Use Recursion?#

  • Iteration vs. Recursion#

    1

    If we observe closely, there are several similarities between iteration and recursion. In recursion, a function performs the same set of operations repeatedly but with different arguments.

    A loop does the same thing except that the value of the iterator and other variables in the loop’s body change in each iteration.

    Figuring out which approach to use is an intuitive process. Many problems can be solved through both.

    Recursion is useful when we need to divide data into different chunks. Iteration is useful for traversing data and also when we don’t want the program’s scope to change.

    Popularity 8/10 Helpfulness 4/10 Language whatever
    Source: Grepper
    Link to this answer
    Share Copy Link
    Contributed on May 16 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.