Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
|
|
@ -3,11 +3,10 @@ import std.stdio, std.algorithm, std.array, std.range;
|
|||
T[] mergeSorted(T)(in T[] D) /*pure nothrow*/ {
|
||||
if (D.length < 2)
|
||||
return D.dup;
|
||||
return [D[0 .. $ / 2].mergeSorted(), D[$ / 2 .. $].mergeSorted()]
|
||||
.nWayUnion().array();
|
||||
return [D[0 .. $ / 2].mergeSorted, D[$ / 2 .. $].mergeSorted]
|
||||
.nWayUnion.array;
|
||||
}
|
||||
|
||||
void main() {
|
||||
auto a = [3, 4, 2, 5, 1, 6];
|
||||
writeln(a.mergeSorted());
|
||||
[3, 4, 2, 5, 1, 6].mergeSorted.writeln;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue