c – 对已经对某些数字进行排序的数组进行部分排序




Timsort is a hybrid sorting algorithm, derived from merge sort and
insertion sort, designed to perform well on many kinds of real-world
data. It was invented by Tim Peters in 2002 for use in the Python
programming language. The algorithm finds subsets of the data that are
already ordered, and uses the subsets to sort the data more


It is a variation of heapsort developed by Edsger Dijkstra in 1981.
Like heapsort, smoothsort’s upper bound is O(n log n). The
advantage of smoothsort is that it comes closer to O(n) time if the
input is already sorted to some degree, whereas heapsort averages
O(n log n) regardless of the initial sorted state.

转载注明原文:c – 对已经对某些数字进行排序的数组进行部分排序 - 代码日志