Anonymous user
Sorting algorithms/Strand sort: Difference between revisions
→Faster version using slices: we're already using the identifier "result" in the enclosing function, better not use it also in the nested function, "res" is clear enough
(Small improvements in second D entry) |
(→Faster version using slices: we're already using the identifier "result" in the enclosing function, better not use it also in the nested function, "res" is clear enough) |
||
Line 285:
T[] strandSort(T)(/*in*/ T[] list) pure nothrow {
static T[] merge(T[] left, T[] right) pure nothrow {
T[]
while (!left.empty && !right.empty) {
if (left.front <= right.front) {
left.popFront;
} else {
right.popFront;
}
}
return
}
|