Hill sorting by JavaScript sorting algorithm

Source: Internet
Author: User
Hill sorting, also known as the descending incremental sorting algorithm, is a fast and stable improved version of insert sorting. Hill sorting is based on the following two properties of insert sorting and proposes an improvement method: insert sorting is highly efficient when performing operations on data with almost sorted orders, that is, linear sorting can be achieved. However, insert sorting is generally inefficient, because insert sorting can only move one bit of data at a time. Hill is named by the name of its designer DonaldShell.

Hill sorting, also known as the descending incremental sorting algorithm, is a fast and stable improved version of insert sorting. Hill sorting proposes an improvement method based on the following two attributes of insert sorting:

  • Insert sorting is highly efficient when performing operations on data in almost sorted order, that is, linear sorting can be achieved.
  • However, insert sorting is generally inefficient, because insert sorting can only move one bit of data at a time.

Hill sorting is named by its designer Donald Shell, which was published in 1959. Some old textbooks and reference manuals name the algorithm Shell-Metzner, which contains the name of Marlene Metzner Norton. However, according to Metzner himself, "I didn't do anything for this algorithm, and my name should not appear in the algorithm name."

The basic idea of Hill Sorting: first take an integer d1 less than n as the first increment, and divide all the records of the file into d1 groups. All records whose distance is multiples of d1 are placed in the same group. Insert and sort data in each group first. then, repeat the group and sort data in the second incremental d2 <d1 until the incremental dt = 1 (dt <dt-l <... <D2 <d1), that is, all records are placed in the same group for direct insertion sorting.

This method is essentially a grouping insertion method.

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.