sorting algorithm Flashcards

1
Q

quicksort: best, avg, worst

A

best: nlogn
avg: nlogn
worst: n^2

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

mergesort: best, avg, worst

A

best: nlogn
avg: nlogn
worst: nlogn

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

heapsort: best, avg, worst

A

best: nlogn
avg: nlogn
worst: nlogn

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

insertion sort: best, avg, worst

A

best: n
avg: n^2
worst: n^2

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

selection: best, avg, worst

A

best: n^2
avg: n^2
worst: n^2

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

shell sort: best, avg, worst

A

best: nlogn
avg: n^(4/3)
worst: n^(3/2)

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

radix sort: best, avg, worst

A

best: n
avg: n
worst: n

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

quicksort: stable, fast, comparison

A

stable: no
fast: yes
comparison: yes

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

mergesort: stable, fast, comparison

A

stable: yes
fast: yes
comparison: yes

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

heapsort: stable, fast, comparison

A

stable: no
fast: yes
comparison: yes

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

insertion sort: stable, fast, comparison

A

stable: yes
fast: no
comparison: yes

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

selection sort: stable, fast, comparison

A

stable: no
fast: no
comparison: yes

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

shell sort: stable, fast, comparison

A

stable: no
fast: no
comparison: yes

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

radix sort: stable, fast, comparison

A

stable:

fast: yes
comparison: no

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

what makes a sorting algorithm stable?

A

can handle duplicates

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

what makes a sorting algorithm fast?

A

a runtime complexity of O(NlogN) or better

17
Q

what makes a sorting algorithm a comparison sorting algorithm?

A

operates on an array of elements that can be compared to each other