- def quicksort(lst):
- if lst:
- l=lst.pop()
- x=[]
- y=[]
- while lst:
- m=lst.pop()
- if m>l:
- x.append(m)
- else:
- y.append(m)
- if x:
- quicksort(x)
- lst.extend(x)
- lst.append(l)
- if y:
- quicksort(y)
- lst.extend(y)
- return lst
- #该片段来自于http://www.codesnippet.cn/detail/270520133590.html
来源: http://www.codesnippet.cn/detail/270520133590.html