Quicksort and Divide-and-Conquer Flashcards

(5 cards)

1
Q

What is the divide-and-conquer strategy?

A

Divide the problem into subproblems, solve them recursively, and combine their results.

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

How does Quicksort work?

A

Chooses a pivot, partitions the array into elements less than and greater than the pivot, and recursively sorts them.

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

What are the time complexities of Quicksort?

A

Best/average case: O(n log n), worst case: O(n²).
In-place, but not stable.

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

When does Quicksort perform poorly?

A

When the pivot is consistently the smallest or largest element—e.g., sorted input with poor pivot choice.

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

What is tail recursion and how is it relevant to Quicksort?

A

Tail recursion occurs when the recursive call is the last operation in a function—used in Quicksort optimizations.

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