def shellTest(l):
h = 1
while h < len(l) / 3: h = h * 3 + 1
while h >= 1:
for i in range(h,len(l)):
while i - h >= 0 and l[i] < l[i - h]:
temp = l[i]
l[i] = l[i - h]
l[i - h] = temp
i -= h
h /= 3
return l
shell sort (python implementation)
最新推荐文章于 2023-06-28 22:11:33 发布