def qsort(list):
left,pivotList,right = [],[],[]
if(len(list)<=1):
return list#递归出口
else:
pivot = list[0]#将第一个值作为基准值
for i in list:
if i < pivot:#比基准值小的放左边
left.append(i)
elif i > pivot:#比基准值大的放右边
right.append(i)
else:
pivotList.append(i)
left = qsort(left)
right = qsort(right)
return left + pivotList + right
l= [11,99,33,69,77,88,55,11,33,36,39,66,44,22]
qsort(l)
[11, 11, 22, 33, 33, 36, 39, 44, 55, 66, 69, 77, 88, 99]