Copyright | Copyright (c) 2015-2016, David Sorokin <david.sorokin@gmail.com> |
---|---|
License | BSD3 |
Maintainer | David Sorokin <david.sorokin@gmail.com> |
Stability | experimental |
Safe Haskell | Safe |
Language | Haskell2010 |
Tested with: GHC 7.10.3
An immutable heap-based priority queue based on book Algorithms: A Functional Programming Approach by Fethi Rabhi and Guy Lapalme.
- data PriorityQueue a
- queueNull :: PriorityQueue a -> Bool
- queueCount :: PriorityQueue a -> Int
- emptyQueue :: PriorityQueue a
- enqueue :: PriorityQueue a -> Double -> a -> PriorityQueue a
- dequeue :: PriorityQueue a -> PriorityQueue a
- queueFront :: PriorityQueue a -> (Double, a)
Documentation
data PriorityQueue a Source
The PriorityQueue
type represents an immutable heap-based priority queue.
Show a => Show (PriorityQueue a) Source |
queueNull :: PriorityQueue a -> Bool Source
Test whether the priority queue is empty.
queueCount :: PriorityQueue a -> Int Source
Return the number of elements in the priority queue.
emptyQueue :: PriorityQueue a Source
An empty priority queue.
enqueue :: PriorityQueue a -> Double -> a -> PriorityQueue a Source
Enqueue a new element with the specified priority.
dequeue :: PriorityQueue a -> PriorityQueue a Source
Dequeue the element with the minimal priority.
queueFront :: PriorityQueue a -> (Double, a) Source
Return the element with the minimal priority.