Copyright | (c) Donnacha Oisín Kidney 2021 |
---|---|
Maintainer | mail@doisinkidney.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
A reference implementation of a pairing heap, to compare to the heap monad.
Documentation
A pairing heap.
This implementation does use a monus rather than just a standard ordered key, but that does not change any of the algorithms really.
Instances
Functor (Heap a) Source # | |
Foldable (Heap a) Source # | |
Defined in MonusWeightedSearch.Internal.Heap fold :: Monoid m => Heap a m -> m # foldMap :: Monoid m => (a0 -> m) -> Heap a a0 -> m # foldMap' :: Monoid m => (a0 -> m) -> Heap a a0 -> m # foldr :: (a0 -> b -> b) -> b -> Heap a a0 -> b # foldr' :: (a0 -> b -> b) -> b -> Heap a a0 -> b # foldl :: (b -> a0 -> b) -> b -> Heap a a0 -> b # foldl' :: (b -> a0 -> b) -> b -> Heap a a0 -> b # foldr1 :: (a0 -> a0 -> a0) -> Heap a a0 -> a0 # foldl1 :: (a0 -> a0 -> a0) -> Heap a a0 -> a0 # elem :: Eq a0 => a0 -> Heap a a0 -> Bool # maximum :: Ord a0 => Heap a a0 -> a0 # minimum :: Ord a0 => Heap a a0 -> a0 # | |
Traversable (Heap a) Source # | |
(Show a, Show b) => Show (Heap a b) Source # | |
Monus a => Semigroup (Heap a b) Source # | |
Monus a => Monoid (Heap a b) Source # | |
minView :: Monus a => Heap a b -> Maybe ((a, b), Heap a b) Source #
O(log n). Pop the minimum element and its key in the heap, and return it.