Chapter 25 Recursion Flashcards

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

Solve 4! recoursive

A

4! = 432*1 = 24

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

By what is a recursive subroutine defined?

A

a recursive is definedin terms of itself

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

What must a recursive have?

A

Base Case

General case

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

What is a base case?

A

The starting point in recursive subroutine

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

What is a general case?

A

4! = 432*1 = 24

in the equation when you multiply 4 with 3 or afterwards 12 with 2 is a general case

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

How must a recoursive function end?

A

In the question solving 4! the answer was a simplification normaly it is
4! = 4 * (4-1)! = 43
3! = 3 * (3-1)! = 3
2
and so on until the base case is reached

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

What happens each time a subroutine is called?

A

A frame is pushed onto the stack

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

What does a stack frame consist of?

A

A stack frame consists of the return address and the values of the local variables

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

What happens when a subroutine completes?

A

The corresponding stack frame is popped off the stack

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