Sorting algorithms/Heapsort: Difference between revisions

m
Line 2,018:
end
 
function heapsort!(a)
n = length(a)
heapify!(a, n)
Line 2,032:
a = shuffle(collect(1:12))
println("Unsorted: $a")
println("Heap sorted: ", heapsort!(a))
</lang>{{output}}<pre>
Unsorted: [3, 12, 11, 4, 2, 7, 5, 8, 9, 1, 10, 6]
4,107

edits