Summary of Sort Methods (cont)
Other properties of sort algorithms: stability, adaptive
Selection sort:
- stability depends on implementation
- not adaptive
Bubble sort:
- is stable if items don't move past same-key items
- adaptive if it terminates when no swaps
Insertion sort:
- stability depends on implementation of insertion
- adaptive if it stops scan when position is found
Quicksort:
- easy to make stable on lists; difficult on arrays
- can be adaptive depending on implementation
Merge sort:
- is stable if merge oeration is stable
- can be made adaptive (but above version is not)
|