ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::BucketHeap< E, C > Class Template Reference

a BucketQueue behind the interface of a heap of pairs \( ( k , x ) \), the key \( k \) of packFG(): the inner queue of a MultiQueue over such keys [see MultiQueue.h], whose pushes and pops take \( O( 1 ) \) amortized time with bounded keys where those of a heap take \( O( \log n ) \). More...

#include <ADS/priority/BucketQueue.h>

Public member functions

 BucketHeap (const C &=C())
 the empty queue
void push (E &&e)
 pushes e
E top (void) const
 the least pair
E pop (void)
 removes the least pair and returns it
bool empty (void) const
 whether the queue has no pair
std::size_t size (void) const
 the number of the pairs

Detailed description

template<class E, class C>
class ADS::BucketHeap< E, C >

a BucketQueue behind the interface of a heap of pairs \( ( k , x ) \), the key \( k \) of packFG(): the inner queue of a MultiQueue over such keys [see MultiQueue.h], whose pushes and pops take \( O( 1 ) \) amortized time with bounded keys where those of a heap take \( O( \log n ) \).

The queue keeps the items and their \( f \) and \( g \), the pair is made again when it comes out; E is an aggregate of a key and an item, in this order, and the order C, which a heap is given, must be the one of std::less on the keys, the one of the queue

Constructor and destructor documentation

◆ BucketHeap()

template<class E, class C>
ADS::BucketHeap< E, C >::BucketHeap ( const C & = C())
inlineexplicit

the empty queue

Member function documentation

◆ empty()

template<class E, class C>
bool ADS::BucketHeap< E, C >::empty ( void ) const
inlinenodiscard

whether the queue has no pair

◆ pop()

template<class E, class C>
E ADS::BucketHeap< E, C >::pop ( void )
inline

removes the least pair and returns it

Precondition
the queue is not empty

◆ push()

template<class E, class C>
void ADS::BucketHeap< E, C >::push ( E && e)
inline

pushes e

◆ size()

template<class E, class C>
std::size_t ADS::BucketHeap< E, C >::size ( void ) const
inlinenodiscard

the number of the pairs

◆ top()

template<class E, class C>
E ADS::BucketHeap< E, C >::top ( void ) const
inlinenodiscard

the least pair

Precondition
the queue is not empty

The documentation for this class was generated from the following file: