# -*- coding:utf-8 -*-
class ShellSort:
def shellSort(self, A, n):
step=3
while step>0:
for i in range(step,n):
p=i
q=i-step
while q>=0:
if A[p]<A[q]:
t=A[p]
A[p]=A[q]
A[q]=t
p=q
q=p-step
else:
break
step-=1
return A
希尔排序--Python
最新推荐文章于 2023-09-06 11:03:55 发布