Sorting Algorithms Flashcards
1
Q
Which sorting algorithms are stable
A
Merge Sort, Insertion Sort, Counting Sort (basic forms)
2
Q
Which sort is the best for nearly-sorted data
A
insertion sort
3
Q
What is the worst-case complexity for Quick sort
A
O(n²), if the pivot is always the worst element.
4
Q
What does it mean if a sort is stable
A
it preserves the relative order of equal elements
5
Q
A