Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Pairing a
- empty :: Pairing a
- null :: Pairing a -> Bool
- singleton :: Ord a => a -> Pairing a
- fromList :: Ord a => [a] -> Pairing a
- insert :: Ord a => a -> Pairing a -> Pairing a
- merge :: Pairing a -> Pairing a -> Pairing a
- union :: Pairing a -> Pairing a -> Pairing a
- mapMonotonic :: Ord a => (t -> a) -> Pairing t -> Pairing a
- findMin :: Pairing a -> Maybe a
- deleteMin :: Pairing a -> Maybe (Pairing a)
- viewMin :: Pairing a -> Maybe (a, Pairing a)
- uncons :: Ord a => Pairing a -> Maybe (a, Pairing a)
- span :: (a -> Bool) -> Pairing a -> (Pairing a, Pairing a)
Documentation
Ephemeral heap, implemented as a Pairing Pairing.
Instances
Basic Operations
insert :: Ord a => a -> Pairing a -> Pairing a Source #
O(1), both amortised and worst, insert an element into a heap.
merge :: Pairing a -> Pairing a -> Pairing a Source #
O(1), both amortised and worst, merges two heaps.
Query
deleteMin :: Pairing a -> Maybe (Pairing a) Source #
O(log n) amortised and O(n) worst, removes the least element and returns remainder.