Section 11 - Programming Flashcards
1
Q
What is recursion?
A
Recursion is when a function calls itself up to a finite amount of times
2
Q
Why does a recursive function need to only run a finite amount of times?
A
If it runs infinitely, it will overflow the stack and completely take up your memory
3
Q
Why does a recursive function need a base case?
A
When the function reaches that point, it ends. It ensures that the function doesn’t run infinitely.
4
Q
A