Graphviz 12.1.0~dev.20240716.1117
|
Pairing heap datastructure implementation. More...
#include <PairingHeap.h>
Public Member Functions | |
PairingHeap (bool(*lessThan)(T const &lhs, T const &rhs)) | |
~PairingHeap () | |
bool | isEmpty () const |
PairNode< T > * | insert (const T &x) |
const T & | findMin () const |
void | deleteMin () |
void | makeEmpty () |
void | merge (PairingHeap< T > *rhs) |
PairingHeap (const PairingHeap &rhs)=delete | |
PairingHeap (PairingHeap &&rhs)=delete | |
PairingHeap & | operator= (const PairingHeap &rhs)=delete |
PairingHeap & | operator= (PairingHeap &&rhs)=delete |
Protected Member Functions | |
PairNode< T > * | getRoot () |
Friends | |
std::ostream & | operator<< (std::ostream &os, const PairingHeap< T > &b) |
Based on example code in "Data structures and Algorithm Analysis in C++" by Mark Allen Weiss, used and released under the LGPL by permission of the author.
No promises about correctness. Use at your own risk!
Authors: Mark Allen Weiss Tim Dwyer tgdwy.nosp@m.er@g.nosp@m.mail..nosp@m.com
Copyright (C) 2005 Authors
This version is released under the CPL (Common Public License) with the Graphviz distribution. A version is also available under the LGPL as part of the Adaptagrams project: https://github.com/mjwybrow/adaptagrams.
If you make improvements or bug fixes to this code it would be much appreciated if you could also contribute those changes back to the Adaptagrams repository.
Definition at line 67 of file PairingHeap.h.
PairingHeap< T >::PairingHeap | ( | bool(*)(T const &lhs, T const &rhs) | lessThan | ) |
Construct the pairing heap.
Definition at line 37 of file PairingHeap.cpp.
PairingHeap< T >::~PairingHeap | ( | ) |
Destroy the leftist heap.
Definition at line 48 of file PairingHeap.cpp.
|
delete |
|
delete |
void PairingHeap< T >::deleteMin | ( | ) |
Remove the smallest item from the priority queue. Throws Underflow if empty.
Definition at line 85 of file PairingHeap.cpp.
const T & PairingHeap< T >::findMin | ( | ) | const |
Find the smallest item in the priority queue. Return the smallest item, or throw Underflow if empty.
Definition at line 74 of file PairingHeap.cpp.
|
inlineprotected |
Definition at line 97 of file PairingHeap.h.
Referenced by PairingHeap< T >::merge().
Insert item x into the priority queue, maintaining heap order. Return a pointer to the node containing the new item.
Definition at line 59 of file PairingHeap.cpp.
References newNode().
bool PairingHeap< T >::isEmpty | ( | ) | const |
Test if the priority queue is logically empty. Returns true if empty, false otherwise.
Definition at line 104 of file PairingHeap.cpp.
void PairingHeap< T >::makeEmpty | ( | ) |
Make the priority queue logically empty.
Definition at line 113 of file PairingHeap.cpp.
|
inline |
Definition at line 80 of file PairingHeap.h.
References PairingHeap< T >::getRoot().
|
delete |
|
delete |
|
friend |