Anonymous user
Sorting algorithms/Quicksort: Difference between revisions
need to worry about multiple pivot elements in array
(C & D) |
(need to worry about multiple pivot elements in array) |
||
Line 293:
if len(L) <= 1: return L
pivot, L = L[0], L[1:]
return qsort([y for y in L if y <= pivot]) + [y for y in L if y == pivot] + \
qsort([y for y in L if y > pivot])
|