Section 11 - Programming Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is recursion?

A

Recursion is when a function calls itself up to a finite amount of times

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.

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