2020-10-04

快速排序
def quick_sort_standard(list,i,j):
key_index=partion(list,i,j)
quick_sort_standard(list,i,key_index)
quick_sort_standard(list,key_index+1,j)
def partion(list,i,j):
key=list[i]
while i while i i-=1
if i < j:
list[j]=list[i]
while i =key:
j+=1
if I < j:
list[i]=list[j]
list [i]=key
return i
list1=[1,3,45,22,78]
quick_sort_standard(list1,0,len(list1-1))
print(list1)

你可能感兴趣的:(笔记)