Just another update
This commit is contained in:
parent
a25938f123
commit
00a190b0a6
6591 changed files with 94363 additions and 23227 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import std.stdio, std.algorithm, std.range, std.array;
|
||||
|
||||
auto quickSort(T)(T[] items) /*pure*/ nothrow {
|
||||
auto quickSort(T)(T[] items) pure nothrow @safe {
|
||||
if (items.length < 2)
|
||||
return items;
|
||||
auto pivot = items[0];
|
||||
immutable pivot = items[0];
|
||||
return items[1 .. $].filter!(x => x < pivot).array.quickSort ~
|
||||
pivot ~
|
||||
items[1 .. $].filter!(x => x >= pivot).array.quickSort;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import std.stdio, std.algorithm;
|
||||
|
||||
void quickSort(T)(T[] items) pure nothrow {
|
||||
void quickSort(T)(T[] items) pure nothrow @safe @nogc {
|
||||
if (items.length >= 2) {
|
||||
auto parts = partition3(items, items[$ / 2]);
|
||||
parts[0].quickSort;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue