Sorting algorithms/Heapsort: Difference between revisions
Content added Content deleted
(Add {{Standard ML solution}}) |
|||
Line 2,616: | Line 2,616: | ||
open IntHeap |
open IntHeap |
||
fun heapsort' Empty = [] |
|||
local |
|||
| heapsort' h = findMin h :: (heapsort' o deleteMin) h; |
|||
⚫ | |||
in |
|||
fun heapsort ls = (heapsort' o build) ls |
|||
end |
|||
in |
in |
||
⚫ | |||
val test_0 = heapsort [] = [] |
val test_0 = heapsort [] = [] |
||
val test_1 = heapsort [1,2,3] = [1, 2, 3] |
val test_1 = heapsort [1,2,3] = [1, 2, 3] |