Sorting algorithms/Heapsort: Difference between revisions
Content added Content deleted
m (→{{header|Sidef}}: updated code) |
m (→{{header|Wren}}: Minor tidy) |
||
Line 6,257: | Line 6,257: | ||
} |
} |
||
var |
var array = [ [4, 65, 2, -31, 0, 99, 2, 83, 782, 1], [7, 5, 2, 6, 1, 4, 2, 6, 3] ] |
||
for (a in |
for (a in array) { |
||
System.print("Before: %(a)") |
System.print("Before: %(a)") |
||
heapSort.call(a) |
heapSort.call(a) |
||
Line 6,276: | Line 6,276: | ||
Alternatively, we can just call a library method. |
Alternatively, we can just call a library method. |
||
{{libheader|Wren-sort}} |
{{libheader|Wren-sort}} |
||
<syntaxhighlight lang="ecmascript">import "/sort" for Sort |
<syntaxhighlight lang="ecmascript">import "./sort" for Sort |
||
var |
var array = [ [4, 65, 2, -31, 0, 99, 2, 83, 782, 1], [7, 5, 2, 6, 1, 4, 2, 6, 3] ] |
||
for (a in |
for (a in array) { |
||
System.print("Before: %(a)") |
System.print("Before: %(a)") |
||
Sort.heap(a) |
Sort.heap(a) |