This module provides a simple implementation of a priority queue with pairing heaps in Curry.
Author: Jan Tikovsky
Version: October 2017
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 |
Priority queue implementation with pairing heaps
Constructors:
Create an empty priority queue
|
Add an element to the priority queue using the given key |