python:三句搞定快排...
时间:2010-08-05 来源:ht8269
def qsort(L): if len(L) <= 1: return L return qsort([lt for lt in L[1:] if lt < L[0]]) + [L[0]] + qsort([ge for ge in L[1:] if ge >= L[0]])
摘自《Python Cookbook》
相关阅读 更多 +
时间:2010-08-05 来源:ht8269
def qsort(L): if len(L) <= 1: return L return qsort([lt for lt in L[1:] if lt < L[0]]) + [L[0]] + qsort([ge for ge in L[1:] if ge >= L[0]])
摘自《Python Cookbook》