class Solution:
def MySort(self , arr ):
# write code here
def qsort(lists,low,high):
if len(lists)<=0 or low>=high:
return
i = low
j = high
pivot = lists[low]
while i<j:
while i<j and pivot<=lists[j]:
j-=1
lists[i] = lists[j]
print(lists)
while i<j and lists[i]<=pivot:
i+=1
lists[j] = lists[i]
print(lists)
lists[j] = pivot
qsort(lists,low,j-1)
qsort(lists,j+1,high)
return
qsort(arr,0,len(arr)-1)
return arr
参考: