Python快排
1 def quick_sort(arr): 2 if len(arr) <= 1: 3 return arr 4 else: 5 base = arr[0] 6 less = [v for v in arr[1:] if v<=base] 7 more = [v for v in arr[1:] if v>base] 8 return quick_sort(less) + [base] + quick_sort(more)
def quick_sort(arr):if len(arr) <= 1: return arr else: base = arr[0] less = [v for v in arr[1:] if v<=base] more = [v for v in arr[1:] if v>base] return quick_sort(less) + [base] + quick_sort(more)
卡卡,你好吗