Sorting algorithms/Heapsort: Difference between revisions

(Add {{Standard ML solution}})
Line 2,616:
open IntHeap
 
fun heapsort' Empty = []
local
fun| heapsort' Emptyh = []findMin h :: (heapsort' o deleteMin) h;
| heapsort' h = findMin h :: (heapsort' o deleteMin) h;
in
fun heapsort ls = (heapsort' o build) ls
end
 
in
|fun heapsort' hls = findMin h :: (heapsort' o deleteMinbuild) h;ls
 
val test_0 = heapsort [] = []
val test_1 = heapsort [1,2,3] = [1, 2, 3]
Anonymous user