Top "Recursion" questions

Recursion is a kind of function call in which a function calls itself.

create array tree from array list

i have a list like this: array( array(id=>100, parentid=>0, name=>'a'), array(id=>101, parentid=>100, …

php arrays recursion tree
Recursive Function palindrome in Python

I need help writing a recursive function which detects whether a string is a palindrome. But i can't use any …

python recursion palindrome
Understanding recursion

I'm having major trouble understanding recursion at school. Whenever the professor is talking about it, I seem to get it …

algorithm recursion tail-recursion
Find all occurrences of a key in nested dictionaries and lists

I have a dictionary like this: { "id" : "abcde", "key1" : "blah", "key2" : "blah blah", "nestedlist" : [ { "id" : "qwerty", "nestednestedlist" : [ { "id" : "xyz", "keyA" : "…

python recursion dictionary traversal
What exactly is a reentrant function?

Most of the times, the definition of reentrance is quoted from Wikipedia: A computer program or routine is described as …

c++ c recursion thread-safety reentrancy
Can every recursion be converted into iteration?

A reddit thread brought up an apparently interesting question: Tail recursive functions can trivially be converted into iterative functions. Other …

language-agnostic recursion iteration
Recursion vs loops

I'm facing a problem where both recursion and using a loop seem like natural solutions. Is there a convention or "…

recursion loops
Does Python optimize tail recursion?

I have the following piece of code which fails with the following error: RuntimeError: maximum recursion depth exceeded I attempted …

python recursion stack stack-overflow tail-recursion
How to delete the last element from an array?

Now I'm working with the recursive backtracking,my assignment is to find the longest path in the maze,the mass …

java arrays recursion backtracking
recursive factorial function

how can I combine these two functions in to one recursive function to have this result: factorial(6) 1! = 1 2! = 2 3! = 6 4! = 24 5! = 120 6! = 720 these are the …

python recursion factorial