53template<
class X,
class INDEX =
int>
111 while ((
papa = idx / 2) > 0) {
147template<
class X,
class INDEX =
int>
246template<
class X,
class Priority =
double,
class STATICCOMPARER = StdComparer<X>,
class INDEX =
int>
Declaration and implementation of Array class and Array algorithms.
The parameterized class Array implements dynamic arrays of type E.
Dynamically growing binary heap tuned for efficiency on a small interface (compared to BinaryHeap).
const X & getMin() const
Returns a reference to the top (i.e., smallest) element of the heap. It does not remove it....
X pop()
Returns the top (i.e., smallest) element and removed it from the heap [Same as extractMin(),...
INDEX size() const
Returns the number of elements in the heap.
INDEX capacity() const
Returns the current array-size of the heap, i.e., the number of elements which can be added before th...
X extractMin()
Returns the top (i.e., smallest) element and removed it from the heap [Same as pop(),...
void clear()
empties the heap [O(1)]
BinaryHeapSimple(INDEX size)
Construtor, giving initial array size.
const X & top() const
Returns a reference to the top (i.e., smallest) element of the heap. It does not remove it....
void insert(X &x)
Adds an element to the heap [Same as push(), O(log n)].
const X & operator[](INDEX idx) const
obtain const references to the element at index idx (the smallest array index is 0,...
void push(X &x)
Adds an element to the heap [Same as insert(), O(log n)].
bool empty() const
Returns true if the heap is empty.
A variant of Top10Heap which deletes the elements that get rejected from the heap.
void insertAndDelete(X *x, Priority p)
Alternative name for pushAndDelete().
void pushAndDelete(X *x, Priority p)
Inserts the element x into the heap with priority p and deletes the element with smallest priority if...
void pushAndDeleteNoRedundancy(X *x, Priority p)
Analogous to pushandDelete(), but furthermore rejects (and deletes) an element if an equal element is...
DeletingTop10Heap(int size)
Construct a DeletingTop10Heap of given maximal capacity.
void insertAndDeleteNoRedundancy(X *x, Priority p)
Alternative name for pushAndKillNoRedundancy().
Augments any data elements of type X with keys of type Priority. This class is also its own Comparer.
A static comparer which compares the target of pointers ("content"), instead of the pointer's adresse...
A variant of BinaryHeapSimple which always holds only the 10 elements with the highest keys.
static bool returnedSomething(PushResult r)
Convenience function: Returns true if the PushResults states that push caused an element to be not/no...
const X & operator[](INDEX idx) const
obtain const references to the element at index idx
PushResult push(X &x, X &out)
Tries to push the element x onto the heap (and may return a removed element as out).
void pushBlind(X &x)
Simple (and slightly faster) variant of Top10Heap::push.
Top10Heap()
Constructor generating a heap which holds the 10 elements with highest value ever added to the heap.
void insertBlind(X &x)
Alternative name for pushBlind().
PushResult insert(X &x, X &out)
Alternative name for push().
static bool successful(PushResult r)
Convenience function: Returns true if the PushResults states that the newly pushed element is new in ...
bool full() const
Returns true if the heap is completely filled (i.e. the next push operation will return something)
PushResult
The type for results of a Top10Heap::push operation.
Declarations for Comparer objects.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.