Prioqueue v0.2.7 Prioqueue.Implementations.PairingHeap View Source

An implementation of a Priority Queue built on top of a Pairing Heap.

Pairing Heaps are nearly as simple as Skew Heaps but are in many contexts the fastest kind of priority queue implementation known.

Pairing Heaps have amortized time bounds.

More information about Pairing Heaps can be found in Issue #16 of the Monad.Reader.

Link to this section Summary

Functions

A variant of reduce that accepts anything that is Combinable as second argument. This Combinable will determine what the empty value and the combining operation will be.

Converts the reducable into a list, by building up a list from all elements, and in the end reversing it.

Link to this section Functions

Link to this function

combine(pairing_heap1, pairing_heap2) View Source

Callback implementation for FunLand.Semicombinable.combine/2.

A variant of reduce that accepts anything that is Combinable as second argument. This Combinable will determine what the empty value and the combining operation will be.

Pass in the combinable module name to start with empty as accumulator, or the combinable as struct to use that as starting accumulator.

Link to this function

reduce(prioqueue, acc, fun) View Source

Callback implementation for FunLand.Reducable.reduce/3.

Converts the reducable into a list, by building up a list from all elements, and in the end reversing it.

This is an automatic function implementation, made possible because Prioqueue.Implementations.PairingHeap implements the FunLand.Reducable behaviour.