Python D&G快速排序
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]))
相关推荐
Masimaro 2020-06-21
Joymine 2020-06-06
清溪算法君老号 2020-06-01
田有朋 2020-04-19
sunjunior 2020-04-10
cmsmdn 2020-03-03
shenwenjie 2020-02-26
sunjunior 2020-02-15
hanyujianke 2020-01-13
路漫 2020-01-12
sunnyJam 2019-12-31
KilluaZoldyck 2019-12-15
yuanran0 2019-12-14
Happyunlimited 2019-12-10
baike 2019-12-09
yishujixiaoxiao 2019-12-02
YUAN 2019-11-19
alicelmx 2019-11-12