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

    Very disappointed to find the top answer to a question titled "What is recursion and when should I use it?" not actually answer either of those, never mind the extremely bias warning against recursion, …

  2. Understanding how recursive functions work - Stack Overflow

    Sep 5, 2014 · The way that I usually figure out how a recursive function works is by looking at the base case and working backwards. Here's that technique applied to this function.

  3. Recursive Function : Check for palindrome in Java

    I have a class that checks whether a string is a palindrome or not. I have two questions. 1) Is this the most efficient way to check for palindrome? 2) Can this be implemented recursively? public

  4. python - recursive factorial function - Stack Overflow

    How can I combine these two functions into one recursive function to have this result: factorial(6) 1! = 1 2! = 2 3! = 6 4! = 24 5! = 120 6! = 720 This is the current code for my factorial functi...

  5. python - Two calls inside a recursive function - Stack Overflow

    Aug 31, 2022 · 1 Recursive calls work no differently than simple function calls. Consider this function f, which makes two calls, one to function a and one to function b:

  6. How to calculate the explicit form of a recursive function?

    Jan 27, 2014 · As an example, consider this recursive function definition, which defines the Collatz sequence: f(1) = 0 f(2n) = 1 + f(n) f(2n + 1) = 1 + f(6n + 4) It's not known whether or not this is even a …

  7. How can I build a recursive function in python? [duplicate]

    Feb 3, 2015 · 10 Recursion in Python works just as recursion in an other language, with the recursive construct defined in terms of itself: For example a recursive class could be a binary tree (or any tree):

  8. Why does my recursive function return None? - Stack Overflow

    Jul 22, 2013 · Use return for recursive function in order to put its value into the stack , so that when function will do recursion values from the stack are taken one by one. If you don't use return , the …

  9. recursion - Examples of Recursive functions - Stack Overflow

    Nov 27, 2013 · Can anybody suggest programming examples that illustrate recursive functions? There are the usual old horses such as Fibonacci series and Towers of Hanoi, but anything besides them …

  10. Recursive function to calculate sum of 1 to n? - Stack Overflow

    Nov 14, 2013 · 2 Recursion is a wrong way to calculate the sum of the first n number, since you make the computer to do n calculations (This runs in O (n) time.) which is a waste. You could even use the …