mlContentsIndex
PriorityQueue
Description

Prioritaetswarteschlangen ueber sog. Pairing Heaps. Siehe dazu auch http://www.cise.ufl.edu/~sahni/dsaaj/enrich/c13/pairing.htm sowie Chris Okasaki, "Purely Functional Data Structures", Cambridge University Press. Wir verwenden die Begriffe Priority Queue und Heap hier synonym.

Implementierung: Dennis Walter, 2010-12-06

Synopsis
data PriorityQueue k a
empty :: Ord k => PriorityQueue k a
null :: Ord k => PriorityQueue k a -> Bool
singleton :: Ord k => k -> a -> PriorityQueue k a
insert :: Ord k => k -> a -> PriorityQueue k a -> PriorityQueue k a
minKeyValue :: Ord k => PriorityQueue k a -> (k, a)
deleteMin :: Ord k => PriorityQueue k a -> PriorityQueue k a
fromList :: Ord k => [(k, a)] -> PriorityQueue k a
toList :: Ord k => PriorityQueue k a -> [(k, a)]
Documentation
data PriorityQueue k a
Ein Heap ist einfach ein binaerer Baum, der zu jedem Element eine Prioritaet enthaelt.
show/hide Instances
(Show a, Show k) => Show (PriorityQueue a k)
empty :: Ord k => PriorityQueue k a
Liefert einen leeren Heap.
null :: Ord k => PriorityQueue k a -> Bool
Testet auf den leeren Heap
singleton :: Ord k => k -> a -> PriorityQueue k a
Einen einelementigen Heap erzeugen.
insert :: Ord k => k -> a -> PriorityQueue k a -> PriorityQueue k a
Einen Wert mit seiner Prioritaet einfuegen.
minKeyValue :: Ord k => PriorityQueue k a -> (k, a)
Rueckgabe der kleinsten Prioritaet (zu verstehen als hoechste Prioritaet) und des dazugehoerigen Wertes.
deleteMin :: Ord k => PriorityQueue k a -> PriorityQueue k a
Das Element mit der hoechsten Prioritaet aus dem Heap entfernen.
fromList :: Ord k => [(k, a)] -> PriorityQueue k a
Einen Heap aus einer Liste erzeugen.
toList :: Ord k => PriorityQueue k a -> [(k, a)]
Einen Heap in einer Liste umwandeln.
Produced by Haddock version 2.6.1