Summary of data structure and algorithm--sort (ii)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.