Jump to content

Sorting algorithms/Quicksort: Difference between revisions

imported>Rcmlz
imported>Rcmlz
Line 8,271:
<syntaxhighlight lang="raku" line>
#| Recursive, single-thread, random pivot, single-pass, quicksort implementation
submulti quicksort(\a where a.elems < 2) { a }
mymulti quicksort(\a, \pivot = a.pick;) {
return a if a.elems < 2;
my \pivot = a.pick;
my %prt{Order} is default([]) = a.classify: * cmp pivot;
|samewith(%prt{Less}), |%prt{Same}, |samewith(%prt{More})
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.