Sorting algorithms/Quicksort: Difference between revisions
Content deleted Content added
remove duplicate section |
|||
Line 1,083:
<lang python>
def qsort(L):
return (qsort([y for y in L[1:] if y <
L[:1] +
qsort([y for y in L[1:] if y >
</lang>
Line 1,095:
else:
pivot = list[0]
less = [x for x in list if x < pivot]
more = [x for x in list[1:] if x >= pivot]
return qsort(less) + [pivot] + qsort(more)
</lang>
|