About 50 results
Open links in new tab
  1. What is recursion and when should I use it? - Stack Overflow

    Recursion is a tree, with branches and leaves, called parents and children respectively. When you use a recursion algorithm, you more or less consciously are building a tree from the data.

  2. Recursion vs loops - Stack Overflow

    Mar 19, 2009 · Recursion is good for proto-typing a function and/or writing a base, but after you know the code works and you go back to it during the optimization phase, try to replace it with a loop.

  3. What are the advantages and disadvantages of recursion?

    Mar 9, 2011 · With respect to using recursion over non-recursive methods in sorting algorithms or, for that matter, any algorithm what are its pros and cons?

  4. list - Basics of recursion in Python - Stack Overflow

    May 13, 2015 · Tail Call Recursion Once you understand how the above recursion works, you can try to make it a little bit better. Now, to find the actual result, we are depending on the value of the previous …

  5. performance - Recursion or Iteration? - Stack Overflow

    Jun 24, 2011 · 19 Recursion is more costly in memory, as each recursive call generally requires a memory address to be pushed to the stack - so that later the program could return to that point. Still, …

  6. algorithm - recursion versus iteration - Stack Overflow

    Feb 23, 2020 · Recursion is usually much slower because all function calls must be stored in a stack to allow the return back to the caller functions. In many cases, memory has to be allocated and copied …

  7. Understanding recursion in the context of Towers of Hanoi

    I'm having trouble understanding recursion. I am trying to solve Towers of Hanoi. How does calling the same function from within itself helps me find the solution for the Towers of Hanoi problem, a...

  8. Understanding how recursive functions work - Stack Overflow

    Sep 5, 2014 · Recursion started making sense to me when I stopped reading what others say about it or seeing it as something I can avoid and just wrote code. I found a problem with a solution and tried to …

  9. Real-world examples of recursion - Stack Overflow

    Sep 20, 2008 · There is no recursion in the real-world. Recursion is a mathematical abstraction. You can model lots of things using recursion. In that sense, Fibonacci is absolutely real-world, as there are …

  10. Convert recursion to iteration - Stack Overflow

    Well, in general, recursion can be mimicked as iteration by simply using a storage variable. Note that recursion and iteration are generally equivalent; one can almost always be converted to the other. A …