各种Sort Function排序方法的O():
| Sort Function | 好 O() | 坏O() | in place? |
|---|---|---|---|
| ##运用Comparision-based sorting: | |||
| Insertion Sort | n | n^2 | in place |
| Merge Sort | nlogn | not in place | |
| Heap Sort | nlogn | in place | |
| Quick Sort | nlogn | n^2 | in place |
| Decision tree model | nlogn | ||
| ##未运用Comparision-based sorting: | |||
| Counting Sort | k+n | not in place | |
| Radix Sort | d(k+n) | not in place | |
| Bucket Sort | n | n^2 | not in place |
本文详细对比了各种排序算法的性能,包括插入排序、归并排序、堆排序、快速排序等基于比较的排序方法,以及计数排序、基数排序、桶排序等非基于比较的排序方法。文中提供了每种算法的最佳、最差时间复杂度及是否就地排序的信息。
498

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



