Sorting Flashcards

1
Q

Insertion Best Case

A

O(n)

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

Insertion Avg Case

A

O(n^2)

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

Insertion Worst Case

A

O(n^2)

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

Selection Best Case

A

O(n^2)

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

Selection Avg Case

A

O(n^2)

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

Selection Worst Case

A

O(n^2)

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

Heap Best Case

A

O(n log n)

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

Heap Avg Case

A

O(n log n)

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

Heap Worst Case

A

O(n log n)

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

Merge Best Case

A

O(n log n)

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

Merge Avg Case

A

O(n log n)

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

Merge Worst Case

A

O(n log n)

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

Quick Best Case

A

O(n log n)

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

Quick Avg Case

A

O(n log n)

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

Quick Worst Case

A

O(n^2)

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

Sorts that are easy on Linked List

A

Insertion, Selection, Merge, Quick

17
Q

Sorts difficult for Linked List

A

Heap Sort

18
Q

Sorts great for arrays

A

Insertion, Selection, Quick

19
Q

Sorts bad for arrays

A

Merge Sort, you need additional array

20
Q

Stability

A

A sorting algorithm is said to be stable if two objects with equal keys appear in the same order in sorted output as they appear in the input array to be sorted. Some sorting algorithms are stable by nature like Insertion sort, Merge Sort, Bubble Sort, etc. And some sorting algorithms are not, like Heap Sort, Quick Sort, etc.

21
Q

Stable Sorts

A

Insertion, Bubble, Merge [IBM] ** Selection can be made stable easily, Linked List version of Quick Sort as well

22
Q

What is the BEST that a comparison based sorting algorithm can run?

A

O(n log n). Because making 2 way decisions take too long.

23
Q

Stable

A

Items with equal keys come out in same order they went in

24
Q

Non Stable sorts

A

Heap Sort ** can still be made stable with secondary key

25
Q

Bucket Best Case

A

O(n + k) k: number of buckets

26
Q

Bucket Avg Case

A

O(n + k) k: number of buckets

27
Q

Bucket Worst Case

A

O(n^2)

28
Q

Radix Best

A

O(nk)

29
Q

Radix Average

A

O(nk)

30
Q

Radix Worst

A

O(nk)