- 时间复杂度O(nlogN)
- 不稳定排序
def shell_sort(arr):
n = len(arr)
gap = n // 2
while gap > 0:
for i in range(gap, n):
j = i
while j > 0:
if arr[j] > arr[j-gap]:
arr[j], arr[j-gap] = arr[j-gap], arr[j]
j-= gap
else:
break
gap /= 2