Quick Sort Flashcards

1
Q

Quick sort is a highly efficient ____-and-_____ sorting algorithm

A

divide-and-conquer

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

Quick sort partitions the around a pivot value that yields _____ < ______ <_______

A

L < pivot < G

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

The mechanism takes ___ elements less than P and ____ elements greater than P. Then applies the ___-and-_____ approach to solve the subproblems. Finally, it _____ the solutions of the subproblem to form the final solution

A

L, G, divide-and-conquer, merges

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

Quick sort’s efficiency heavily depends on the choice of the _____ element.

A

pivot

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

What is a pivot that is randomly selected?

A

random pivot

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

What is a pivot that is the first entry of the list?

A

first element pivot

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

What is a pivot that takes the median of the first, middle, and last element in the list?

A

median-of-three pivot

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

What is the best pivot to use for quick sort? Why?

A

median-of-three because it uses O(n log n)

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

What is the best-case time complexity for quick sort?

A

O(n log n)

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

What is the worst-case time complexity for quick sort? (depending on the pivot chosen)

A

O(n^2)

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

What is the space complexity for quick sort?

A

O(log n)

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

For space complexity, quick sort uses _____ stack.

A

recursion

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

Does quick sort use frequent swaps for partitioning?

A

yes!

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

Merge sort is a _________ sorting method.

A

recursive

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