58#ifndef __ADS_IndexedHeapPair
59 #define __ADS_IndexedHeapPair
84template<
class K ,
class Bd = K ,
unsigned D = 4 >
105 [[nodiscard]]
int ids(
void )
const {
return( f_key.ids() ); }
108 [[nodiscard]]
bool empty(
void )
const {
return( f_key.empty() ); }
111 [[nodiscard]] std::size_t
size(
void )
const {
return( f_key.size() ); }
116 return( f_key.contains(
id ) );
121 [[nodiscard]]
const K &
key(
int id )
const {
return( f_key.key(
id ) ); }
125 [[nodiscard]]
const Bd &
bound(
int id )
const {
126 return( f_bound.key(
id ) );
142 void push(
int id ,
const K & k ,
const Bd & b );
156 void update(
int id ,
const K & k ,
const Bd & b );
173 [[nodiscard]]
int top(
void )
const {
return( f_key.top().id ); }
177 [[nodiscard]]
const K &
topKey(
void )
const {
return( f_key.top().key ); }
182 return( f_bound.top().key );
187 [[nodiscard]]
int minBoundId(
void )
const {
return( f_bound.top().id ); }
240#include "ADS/priority/impl/IndexedHeapPair.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
A -ary heap of the integers with keys and decrease-key, beyond the book: the heap of DaryHeap [see D...
a -ary heap of the ids by their keys, the least on top, with decrease-key, its changes told through ...
Definition IndexedDaryHeap.h:136
int pop(void)
removes the id of least key and returns it, in time
IndexedHeapPair(int n=0)
the empty queue of the ids
Definition IndexedHeapPair.h:95
int top(void) const
the id of least key
Definition IndexedHeapPair.h:173
K Key
the type of the keys of selection
Definition IndexedHeapPair.h:90
bool contains(int id) const
whether the id is in the queue
Definition IndexedHeapPair.h:115
const Bd & minBound(void) const
the least bound of the ids in the queue
Definition IndexedHeapPair.h:181
bool empty(void) const
whether the queue has no id
Definition IndexedHeapPair.h:108
void update(int id, const K &k, const Bd &b)
sets the key of the id to and its bound to , each heap moving the id up or down, in time
int ids(void) const
the number of ids,
Definition IndexedHeapPair.h:105
void reset(int n)
the empty queue of the ids , the room kept
Definition IndexedHeapPair.h:99
void erase(int id)
removes the id from the queue, in time
int popMinBound(void)
removes the id of least bound and returns it, as pop() by the other heap
void clear(void)
removes all the ids, in time
Definition IndexedHeapPair.h:220
Bd Bound
the type of the bounds
Definition IndexedHeapPair.h:91
void push(int id, const K &k, const Bd &b)
inserts the id with the key and the bound , in time
int minBoundId(void) const
an id of least bound
Definition IndexedHeapPair.h:187
const K & key(int id) const
the key of an id in the queue
Definition IndexedHeapPair.h:121
const Bd & bound(int id) const
the bound of an id in the queue
Definition IndexedHeapPair.h:125
const K & topKey(void) const
the least key, that of top()
Definition IndexedHeapPair.h:177
std::size_t size(void) const
the number of ids in the queue,
Definition IndexedHeapPair.h:111