帮我写一段快速排序代码
时间: 2023-03-08 17:59:17 浏览: 20
def QuickSort(array):
if len(array) <= 1:
return array
else:
pivot = array[0]
less = [i for i in array[1:] if i <= pivot]
greater = [i for i in array[1:] if i > pivot]
return QuickSort(less) + [pivot] + QuickSort(greater)QuickSort(array)
阅读全文