| Copyright | Copyright (c) 2015-2017 David Sorokin <david.sorokin@gmail.com> |
|---|---|
| License | BSD3 |
| Maintainer | David Sorokin <david.sorokin@gmail.com> |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Simulation.Aivika.PriorityQueue.Pure
Description
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.
Synopsis
- 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.
Instances
| Show a => Show (PriorityQueue a) Source # | |
Defined in Simulation.Aivika.PriorityQueue.Pure Methods showsPrec :: Int -> PriorityQueue a -> ShowS # show :: PriorityQueue a -> String # showList :: [PriorityQueue a] -> ShowS # | |
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.