Introduction - If you have any usage issues, please Google them yourself
First, take an integer gap < n (the number of records to be sorted) as the interval, all records will be divided into sub-sequence gap, all distances for the gap recorded in the same sub-sequence, respectively, in each sub-sequence directly into sorting purposes. Then narrow spacing gap, for example, take the gap = gap/2 sequence described above is repeated division and sorting work, until finally take gap = 1, all records in the same sort sequence so far