标签:for lse pytho pivot ali gre div quick quic
两个list合并,从小到大排序,不用功sorted函数
a=[1,3,2,78,32,4554] b=[23,32,23,45,45] def quick_sort(alist): if alist==[]: return [] else: pivot=alist[0] lesser=quick_sort([x for x in alist[1:] if x<=pivot]) greater=quick_sort([x for x in alist[1:] if x>pivot]) return lesser+[pivot]+greater quick_sort(a+b)
标签:for lse pytho pivot ali gre div quick quic
原文地址:https://www.cnblogs.com/bafenqingnian/p/9366765.html