21 #ifndef Minisat_Heap_h
22 #define Minisat_Heap_h
33 template<
class K,
class Comp,
class MkIndex = MkIndexDefault<K> >
40 static inline int left (
int i) {
return i*2+1; }
41 static inline int right (
int i) {
return (i+1)*2; }
42 static inline int parent(
int i) {
return (i-1) >> 1; }
50 while (i != 0 &&
lt(x,
heap[p])){
66 if (!
lt(
heap[child], x))
break;
77 Heap(
const Comp& c, MkIndex _index = MkIndex()) :
indices(_index),
lt(c) {}
141 for (
int i = 0; i <
heap.
size(); i++)
145 for (
int i = 0; i < ns.
size(); i++){
151 for (
int i =
heap.
size() / 2 - 1; i >= 0; i--)
158 for (
int i = 0; i <
heap.
size(); i++)
void percolateDown(int i)
int operator[](int index) const
IntMap< K, int, MkIndex > indices
void build(const vec< K > &ns)
const T & last(void) const
void reserve(K key, V pad)
Heap(const Comp &c, MkIndex _index=MkIndex())
void clear(bool dealloc=false)
void clear(bool dispose=false)