Sorting algorithms/Quicksort: Difference between revisions

Content added Content deleted
(Undo revision 184463 by Bearophile (talk))
(Updated first D entry)
Line 1,012:
<lang d>import std.stdio, std.algorithm, std.range, std.array;
 
auto quickSort(T)(T[] items) /*pure*/ nothrow @safe {
if (items.length < 2)
return items;
autoimmutable pivot = items[0];
return items[1 .. $].filter!(x => x < pivot).array.quickSort ~
pivot ~