This is a sort of gap algorithm that needs to be counted
Hill sort of gap is getting smaller
And the merged sort of gap is getting bigger
Example: If there are 11 numbers
The order of Hill sort is
Gap=11/2=5 (0, 5, 10) (1, 6) (2, 7) (3, 8) (4, 9)
gap=5/2=2 (0, 2, 4, 6, 8, 10) (1, 3, 5, 7, 9)
Gap=2/2=1 (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
The order of the merge sort is
gap=2 (0, 1) (2, 3) (4, 5) (6, 7) (8, 9) (10)
gap=2*2 = 4 (0, 1, 2, 3) (4, 5, 6, 7) (8, 9, 10)
Gap=4*2=8 (0, 1, 2, 3, 4, 5, 6, 7) (8, 9, 10)
Gap=8*2=16>n (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
Hill sort is a kind of insert sort method, the time complexity is the most quickly o (n), the slowest is O (n^2), each small interval is inserted sort of way, do not need to request additional auxiliary space O (1).
Merge sort is the merge sort, the time complexity is O (NLOGN) level, each time to apply for a gap length of the auxiliary space used to merge 2, so the space complexity of O (n).