Anonymous user
Sorting algorithms/Insertion sort: Difference between revisions
Updated D entry
No edit summary |
(Updated D entry) |
||
Line 322:
=={{header|D}}==
<lang d>void insertionSort(T)(T[] data) pure nothrow {▼
<lang d>import std.stdio;▼
▲void insertionSort(T)(T[] data) pure nothrow {
foreach (i, value; data[1 .. $]) {
auto j = i + 1;
Line 332 ⟶ 330:
}
}
void main() {
auto
writeln(items);
}</lang>
{{out}}
<pre>[2, 4, 11, 17, 19, 24, 25, 28, 44, 46]</pre>
|