排序算法
1、看一下各排序算法的时间复杂度
| 排序算法名 | 时间复杂度 | 空间复杂度 | 排序算法稳定性 |
|---|---|---|---|
| 冒泡排序 | 最差、平均:O(n^2) 最好:O(n) | 1 | 稳定 |
| 插入排序 | 最差、平均:O(n^2) 最好:O(n) | 1 | 稳定 |
| 选择排序 | 最差、平均:O(n^2) | 1 | 不稳定 |
| 快速排序 | 平均:O(n log n) 最坏:O(n^2) | O(log n) | 不稳定 |
| 堆排序 | 最差、平均、最好:O(n log n) | 1 | 不稳定 |
| 归并排序 | 最差、平均、最好:O(n log n) | O(n) | 稳定 |
| 希尔排序 | 平均:O(n log n),依赖步长所以其他时间复杂度不好推导 | 1 | 不稳定 |
2、各排序算法的具体实现
1)冒泡排序
https://blog.csdn.net/stoneWang_L/article/details/89220461
2)插入排序
https://blog.csdn.net/stoneWang_L/article/details/89221348
3)选择排序
https://blog.csdn.net/stoneWang_L/article/details/89220638
4)快速排序
https://blog.csdn.net/stoneWang_L/article/details/89221592
5)堆排序
https://blog.csdn.net/stoneWang_L/article/details/89190250
6)归并排序
https://blog.csdn.net/stoneWang_L/article/details/89210938
7)希尔排序
https://blog.csdn.net/stoneWang_L/article/details/89217137

5506

被折叠的 条评论
为什么被折叠?



