Anonymous user
Sorting algorithms/Heapsort: Difference between revisions
+ second D version
m (→{{header|REXX}}: corrected a misspelling. -- ~~~~) |
(+ second D version) |
||
Line 592:
siftDown(seq, 0, end - 1);
}
}
void main() {
auto arr = [7, 6, 5, 9, 8, 4, 3, 1, 2, 0];
inplaceHeapSort(arr);
writeln(arr);
}</lang>
===Using Standard Functions===
<lang d>import std.stdio, std.container;
void inplaceHeapSort(T)(T[] data) {
auto h = heapify(data);
while (!h.empty)
h.removeFront();
}
|