equal
deleted
inserted
replaced
54 |
54 |
55 fun merge (h, Empty) = h |
55 fun merge (h, Empty) = h |
56 | merge (Empty, h) = h |
56 | merge (Empty, h) = h |
57 | merge (h1 as Heap (_, x1, a1, b1), h2 as Heap (_, x2, a2, b2)) = |
57 | merge (h1 as Heap (_, x1, a1, b1), h2 as Heap (_, x2, a2, b2)) = |
58 (case ord (x1, x2) of |
58 (case ord (x1, x2) of |
59 Library.GREATER => heap x2 a2 (merge (h1, b2)) |
59 GREATER => heap x2 a2 (merge (h1, b2)) |
60 | _ => heap x1 a1 (merge (b1, h2))); |
60 | _ => heap x1 a1 (merge (b1, h2))); |
61 |
61 |
62 fun insert (x, h) = merge (Heap (1, x, Empty, Empty), h); |
62 fun insert (x, h) = merge (Heap (1, x, Empty, Empty), h); |
63 |
63 |
64 end; |
64 end; |