--- 希尔排序 --- 分组插入排序算法 每趟使整体数据越来越接近有序
def insert_sort_gap(li, gap):
for i in range(gap, len(li)):
temp = li[i]
j = i - gap
while j >= 0 and li[j] > temp:
li[j + gap] = li[j]
j -= gap
li[j + gap] = temp
def shell_sort(li):
d = len(li) // 2
while d >= 1:
insert_sort_gap(li, d)
d //= 2