def quicksort(array):
less = []
greater = []
if len(array) <= 1:
return array
pivot = array.pop()
for x in array:
if x <= pivot:
less.append(x)
else:
greater.append(x)
return quicksort(less) + [pivot]+quicksort(greater)
if __name__ == '__main__':
print(quicksort([1, 3, 5, 2, 4, 85, 65]))
输出: