Sorting algorithms/Quicksort: Difference between revisions
Content added Content deleted
imported>Rcmlz |
imported>Rcmlz |
||
Line 8,270: | Line 8,270: | ||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
<syntaxhighlight lang="raku" line> |
<syntaxhighlight lang="raku" line> |
||
#| Recursive, single-thread, single-pass, quicksort implementation |
#| Recursive, single-thread, random pivot, single-pass, quicksort implementation |
||
sub quicksort( |
sub quicksort(\a) { |
||
return |
return a if a.elems < 2; |
||
my |
my \pivot = a.pick; |
||
my %prt{Order} is default([]) = |
my %prt{Order} is default([]) = a.classify: * cmp pivot; |
||
|samewith(%prt{Less}), |%prt{Same}, |samewith(%prt{More}) |
|samewith(%prt{Less}), |%prt{Same}, |samewith(%prt{More}) |
||
} |
} |