34#ifndef __ADS_TreePriorityQueue
35 #define __ADS_TreePriorityQueue
65template<
class T , std::totally_ordered P =
int >
69 using Key = std::pair< P , long >;
78 [[nodiscard]]
bool empty(
void )
const;
81 [[nodiscard]]
int size(
void )
const;
86 [[nodiscard]]
const T &
min(
void )
const;
163 [[nodiscard]]
bool consistent(
void )
const;
166 std::vector< P > f_p;
178#include "ADS/priority/impl/TreePriorityQueue.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The iterators that the containers of the library have in common, beyond the book: they give a contain...
The PRIORITYQUEUE of section 10.1, with decreasing priority, in two concepts.
The binary search tree (ABR) and the Red-Black tree of the book, as a DICTIONARY [see ADT....
std::pair< K, V > value_type
Definition SearchTree.h:521
a priority queue on a Red-Black tree of the pairs of a priority and of a number of insertion
Definition TreePriorityQueue.h:67
const_iterator cend(void) const
the same as end()
Definition TreePriorityQueue.h:158
const_iterator end(void) const
the end of the view
Definition TreePriorityQueue.h:154
long Handle
the number of insertion of an item
Definition TreePriorityQueue.h:75
P Priority
the type of the priorities
Definition TreePriorityQueue.h:74
T Item
the type of the items
Definition TreePriorityQueue.h:73
const T & min(void) const
the item of smallest priority, the leftmost node of the tree, in time
typename RedBlackTree< Key, T >::const_iterator const_iterator
the iterator of the view, constant
Definition TreePriorityQueue.h:147
Handle insert(const T &x, const P &p)
inserts with the priority and gives its handle, in time
typename RedBlackTree< Key, T >::value_type value_type
the type of the items of the view
Definition TreePriorityQueue.h:145
const_iterator begin(void) const
the first item of the view
Definition TreePriorityQueue.h:152
T deleteMin(void)
removes the item of smallest priority and returns it, in time
void decrease(Handle y, const P &p)
lowers to the priority of the item of the handle , in time
int size(void) const
the number of items,
bool empty(void) const
whether the queue has no item
const_iterator iterator
the same as const_iterator
Definition TreePriorityQueue.h:149
const_iterator cbegin(void) const
the same as begin()
Definition TreePriorityQueue.h:156
SearchTree< K, V, true > RedBlackTree
the Red-Black tree of section 6.2
Definition SearchTree.h:619