Sorting Algorithms Flashcards

1
Q

Which sorting algorithms are stable

A

Merge Sort, Insertion Sort, Counting Sort (basic forms)

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

Which sort is the best for nearly-sorted data

A

insertion sort

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

What is the worst-case complexity for Quick sort

A

O(n²), if the pivot is always the worst element.

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

What does it mean if a sort is stable

A

it preserves the relative order of equal elements

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