Recursion Flashcards
1
Q
When do you use recursion?
A
When your problem can be divided into subproblems and solved with the same strategy
2
Q
What are the two methods of retaining state with a recursive function?
A
- Threading the state through each recursive call by passing the state values in as arguments
- Keeping a state in global scope (
global value
)