aivika-4.6: A multi-method simulation library

CopyrightCopyright (c) 2015-2016 David Sorokin <david.sorokin@gmail.com>
LicenseBSD3
MaintainerDavid Sorokin <david.sorokin@gmail.com>
Stabilityexperimental
Safe HaskellSafe
LanguageHaskell2010

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

Documentation

data PriorityQueue a Source #

The PriorityQueue type represents an immutable heap-based priority queue.

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.