34template<
class Type,
class Key>
43template<
class Type,
class Key>
44AbaBHeap<Type, Key>::AbaBHeap(
52 for (
int i = father(n_-1); i>=0; --i)
57template<
class Type,
class Key>
60 for(
int i = 0; i < rhs.n_; i ++)
61 out << rhs.heap_[i] <<
" (" << rhs.keys_[i] <<
") ";
67template<
class Type,
class Key>
68void AbaBHeap<Type, Key>::insert(Type
elem, Key key)
84 while (i > 0 && keys_[
f] > key) {
96template<
class Type,
class Key>
97Type AbaBHeap<Type, Key>::getMin()
const
109template<
class Type,
class Key>
110Key AbaBHeap<Type, Key>::getMinKey()
const
122template<
class Type,
class Key>
123Type AbaBHeap<Type, Key>::extractMin()
130 heap_[0] = heap_[n_];
131 keys_[0] = keys_[n_];
139template<
class Type,
class Key>
140void AbaBHeap<Type, Key>::clear()
146template<
class Type,
class Key>
147inline int AbaBHeap<Type, Key>::size()
const
153template <
class Type,
class Key>
154inline int AbaBHeap<Type, Key>::number()
const
160template<
class Type,
class Key>
161inline bool AbaBHeap<Type, Key>::empty()
const
163 if(n_ == 0)
return true;
168template<
class Type,
class Key>
169void AbaBHeap<Type, Key>::realloc(
int newSize)
176template<
class Type,
class Key>
177void AbaBHeap<Type, Key>::check()
const
179 for(
int i = 0; i < n_/2; i++)
180 if (keys_[i] > keys_[leftSon(i)] || (rightSon(i) < n_ && heap_[i] > heap_[rightSon(i)])) {
181 Logger::ifout() <<
"AbaBHeap:check(): " << i <<
" violates heap\n";
187template <
class Type,
class Key>
188inline int AbaBHeap<Type, Key>::leftSon(
int i)
const
194template <
class Type,
class Key>
195int AbaBHeap<Type, Key>::rightSon(
int i)
const
201template <
class Type,
class Key>
202inline int AbaBHeap<Type, Key>::father(
int i)
const
208template <
class Type,
class Key>
209void AbaBHeap<Type, Key>::heapify(
int i)
AbaBHeap(int size)
A constructor.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
#define OGDF_THROW_PARAM(CLASS, PARAM)
Replacement for throw.
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.