Sorting algorithms compared on stable, in-place, and comparison properties
Stable sort - Sorting stability means that records with the same key retain their relative order before and after the sort.
In-place sort - A sort algorithm in which the sorted items occupy the same storage as the unsorted ones is in-place sort algorithm.
Comparison sort - It is an algorithm that compares two keys (values) and nothing else to find which one should appear first in the sorted list.
Sorting algorithm
|
Stable?
|
Comparison?
|
In-place?
|
Quick sort
|
NO
|
YES
|
YES
|
Merge sort
|
YES
|
YES
|
NO
|
Heap sort
|
NO
|
YES
|
YES
|
Insertion sort
|
YES
|
YES
|
YES
|
NO
|
YES
|
YES
|
|
Bubble sort
|
YES
|
YES
|
YES
|
Least Significant Digit Radix sort
|
YES
|
NO
|
|
Most Significant Digit Radix sort
|
NO
|
NO
|
YES
|
Shell sort
|
NO
|
YES
|
YES
|
**********
What is stable sort?
compare different sorting algorithms on stable property, in-place property and comparison property,
No comments:
Post a Comment