标签:int 排列 style pytho quick code 快速 color quic
def quickmothod(li,low,high):
left=low
right=high
if left right:
key=li[left]
while leftright:
while leftand li[right]>=key:
right -= 1
li[right],li[left]=li[left],li[right]
while leftand li[left]key:
left += 1
li[left],li[right]=li[right],li[left]
quickmothod(li,low,left-1)
quickmothod(li,right+1,high)
li = [5,18,22,33,100,0,15,12,15,0,22,33,0,22,0,22]
quickmothod(li,0,len(li)-1)
print(li)
# def quick(li,p,q):
# left=p
# right=q
# if left
# while left
# while li[left]
# left+=1
# li[left],li[right]= li[right],li[left]
# while li[left]=li[0]:
# right-=1
# li[left],li[right]= li[right],li[left]
# quick(li,p,left-1)
# quick(li,right+1,q)
# li=[10,20,30,1,2,3]
# quick(li,0,len(li)-1)
# print(li)
python 快速排列
标签:int 排列 style pytho quick code 快速 color quic
原文地址:https://www.cnblogs.com/wan-612/p/11153097.html