- Stability, internal and external storage, ordered area, unordered Area
Stability (personal understanding): The original relative positions of the same number remain unchanged, which means stability.
| |
Average time complexity |
Worst time complexity |
Auxiliary space (space complexity) |
Stable? |
Best time complexity |
|
|
| Select sort |
|
|
|
Unstable |
|
|
|
| Hill sorting |
|
|
|
Unstable |
|
|
|
| Heap sorting |
|
|
|
Unstable |
|
|
|
| Fast sorting |
N * log (N) |
N2 |
A stack space is required for recursion. The worst is N, which can be log (n) |
Unstable |
|
|
|
| |
|
|
|
|
|
|
|
| Bubble |
N2 |
N2 |
O (1) |
Stability |
N (N-1 times comparison) |
|
|
| Cocktail (two-way bubble) |
|
|
|
Stability |
|
|
|
| Merge |
|
|
|
Stability |
|
|
|
| Binary Tree sorting |
|
|
|
Stability |
|
|
|
| Insert |
|
|
|
Stability |
|
|
|
| |
|
|
|
|
|
|
|
| |
|
|
|
|
|
|
|
- Basic operation: Compare the keyword size
Change the pointer to the record or move the record itself
- Common storage methods for objects to be sorted: sequential tables (such as arrays), linked lists,
[Basic algorithm] sorting