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)
帮我写一段快速排序代码
最新推荐文章于 2024-08-22 17:27:46 发布