def shell_sort(alist):
n=len(alist)
gap= int(n / 2) #步长
while gap>0:
for i in range(gap,n):
j=i
while j>=gap and alist[j-gap] > alist[j]:
alist[j-gap],alist[j]=alist[j],alist[j-gap] #交换值
j-=gap
gap=int(gap/2) #新的步长
alist=[11,33,44,55,66,9,72,86,93,10,1,0,2]
shell_sort(alist)
print(alist)