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.