Module Data.PQ

This module provides a simple implementation of a priority queue with pairing heaps in Curry.

Author: Jan Tikovsky

Version: October 2017

Summary of exported operations:

emptyPQ :: PQ a b   
Create an empty priority queue
findMin :: Eq a => PQ b a -> Maybe a   
Get the element with the minimum key from the priority queue
enqueue :: Ord a => a -> b -> PQ a b -> PQ a b   
Add an element to the priority queue using the given key
dequeue :: (Ord a, Eq b) => PQ a b -> Maybe (b,PQ a b)   
Remove an element from the priority queue and return it together with the remaining queue
merge :: Ord a => PQ a b -> PQ a b -> PQ a b   
Merge two priority queues

Exported datatypes:


PQ

Priority queue implementation with pairing heaps

Constructors:


Exported operations:

emptyPQ :: PQ a b   

Create an empty priority queue

Further infos:
  • solution complete, i.e., able to compute all solutions

findMin :: Eq a => PQ b a -> Maybe a   

Get the element with the minimum key from the priority queue

enqueue :: Ord a => a -> b -> PQ a b -> PQ a b   

Add an element to the priority queue using the given key

dequeue :: (Ord a, Eq b) => PQ a b -> Maybe (b,PQ a b)   

Remove an element from the priority queue and return it together with the remaining queue

merge :: Ord a => PQ a b -> PQ a b -> PQ a b   

Merge two priority queues