用python实现冒泡,选择,快速排序
def paixu(ls,left,right): low = lefthigh = right
key = ls
while right > left:
while right > left and ls >= key:
right -= 1
ls = ls
while right > left and ls <= key:
left += 1
ls = ls
ls = key
if low < left-1:
paixu(ls,low,left-1)
if left+1 < high:
paixu(ls,left+1,high)
return ls
页:
[1]