1.2 Hill Sort
Hill sort belongs to the insertion sort, is the optimization of the direct insertion sort, the main idea is: because in the case of the sequence is basically orderly, the efficiency is very high, then we introduce an increment incre, the element with Incre as the interval of the direct insertion sort, make it basically orderly; Incre slowly reduce, continue to do the above direct insertion sort, the final incre into 1, degenerate into a direct insertion sort, but this time the sequence has been basically orderly, sorting efficiency is very high. The fact is that a relatively small element jumps forward. Its process:
Time, space complexity, stability, and application scenarios for hill sequencing
, the performance of hill sorting is not good in four improvement algorithms (in O (NLGN) ~o (n^2), the other 3 average time complexity is O (NLGN)), but the meaning of the hill sort is to break through the O (n^2) limit, for later better algorithm opened the train of thought.
Summary of data structure and algorithm--sort (ii)