Sorting algorithms/Quicksort: Difference between revisions
Content added Content deleted
Line 266: | Line 266: | ||
if len(L) <= 1: return L |
if len(L) <= 1: return L |
||
pivot = random.choice(L) |
pivot = random.choice(L) |
||
return qsort([ |
return qsort([lt for lt in L if lt < pivot]) + [pivot]*L.count(pivot) + \ |
||
qsort([gt for gt in L if gt > |
qsort([gt for gt in L if gt > pivot]) |
||
=={{header|Seed7}}== |
=={{header|Seed7}}== |