Are these algorithms stable and/or in place Flashcards
1
Q
What is stability?
A
A sorting algorithm is stable if any pair of equal numbers in the input array appear in the same order in the sorted array.
2
Q
What is in place?
A
A sorting algorithm is in place if at any moment at most O(1) array elements are stored outside the array.
3
Q
Insertion Sort.
A
Stable: Yes
In place: Yes
4
Q
Merge Sort.
A
Stable: Yes
In place: No
5
Q
Heap Sort.
A
Stable: No
In place: Yes
6
Q
Quicksort
A
Stable: No
In place: Yes
7
Q
Countingsort
A
Stable: Yes
In place: No
8
Q
Radixsort.
A
Stable: Yes
In place: No