Recursion Flashcards

1
Q

What data structure is used to keep track of recursion?

A

A stack.

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

Stack frames (or activation records) reference what?

A

A complete copy of the method definition.

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

When condition occurs when a stack attempts to grow beyond its limit?

A

Stack overflow.

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

Any task that can be done using recursion can also be done iteratively.

A

True.

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

Recursive methods usually run faster than their iterative counterparts.

A

False, they will usually run slower.

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

Iterative versions of methods usually use more storage than the recursive versions.

A

False, recursively written methods will usually use more storage.

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

Recursion is not limited to void methods.

A

True.

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

Recursive methods can return a value of any type.

A

True.

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

What is the worst-case running time of the binary search algorithm (using big O notation)?

A

O(log n)

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

What is the worst-case running time of a serial search algorithm (using big O notation)?

A

O(n)

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