标签:quicksort style turn enter return int partition quick i+1
def partition(arr,low, high): i=(low-1) p=arr[high] for j in range(low, high): if arr[j]<=p: i+=1 arr[i],arr[j]=arr[j],arr[i] arr[i+1],arr[high]=arr[high],arr[i+1] return i+1 def quicksort(arr,low,high): if low<high: base=partition(arr,low,high) quicksort(arr,low,base-1) quicksort(arr,base+1,high) arr=[10,203,20,22,11,100] n=len(arr) quicksort(arr,0,n-1) print(‘ ‘.join(map(str, arr)))
标签:quicksort style turn enter return int partition quick i+1
原文地址:https://www.cnblogs.com/z-712/p/14494692.html