Recursion and Recurrence Relations Flashcards

1
Q

What is recursion?

A

A function calling itself to solve a smaller instance of the same problem.

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

What is a base case in recursion?

A

The condition that stops the recursion to prevent infinite loops.

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

What is a recurrence relation?

A

An equation defining a function in terms of smaller inputs.

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

Solve the recurrence relation: T(n) = T(n/2) + O(1).

A

O(log n) using the recurrence tree method.

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

What is tail recursion?

A

A recursive function where the recursive call is the last operation, allowing for optimization into iteration.

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

What is the recurrence relation for Merge Sort?

A

T(n) = 2T(n/2) + O(n).

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

What is the Master Theorem?

A

A formula to solve recurrence relations in divide-and-conquer algorithms.

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