Recursion Flashcards

1
Q

When do you use recursion?

A

When your problem can be divided into subproblems and solved with the same strategy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the two methods of retaining state with a recursive function?

A
  1. Threading the state through each recursive call by passing the state values in as arguments
  2. Keeping a state in global scope (global value)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly