标签:less pivot ESS quicksort highlight bsp int java 元素
def quicksort(array): if len(array)<2: 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) print (quicksort([30,20,55,31]))
标签:less pivot ESS quicksort highlight bsp int java 元素
原文地址:https://www.cnblogs.com/MR---Zhao/p/12736711.html