Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
BinomialQueue< T, C, A > Class Template Reference

#include <elm/data/BinomialQueue.h>

+ Inheritance diagram for BinomialQueue< T, C, A >:

Public Member Functions

 BinomialQueue (const C &c=single< C >(), const A &a=single< A >())
 
bool isEmpty () const
 
const T & head () const
 
get ()
 
void put (const T &x)
 
- Public Member Functions inherited from Comparator< T >
int doCompare (const T &v1, const T &v2) const
 
- Public Member Functions inherited from DefaultAllocatorDelegate
t::ptr allocate (t::size size) const
 
void free (t::ptr p) const
 
template<class T >
T * alloc () const
 

Additional Inherited Members

- Public Types inherited from Comparator< T >
typedef T t
 
- Static Public Member Functions inherited from Comparator< T >
static int compare (const T &v1, const T &v2)
 

Detailed Description

template<class T, class C = Comparator<T>, class A = DefaultAlloc>
class elm::BinomialQueue< T, C, A >

Implements the binomial priority queue.

The performance of the queue are:

  • pick - O(1)
  • take - O(log n)
  • put - O(1) (amortized)
  • memory - for each element, 2 pointers and 1 integer are required.
Parameters
TType of elements in the queue.
CComparator type (default to elm::Comparator).
AAllocator type (default to elm::DefaultAllocatorDelegate).

Constructor & Destructor Documentation

◆ BinomialQueue()

BinomialQueue ( const C &  c = single<C>(),
const A &  a = single<A>() 
)
inline

Build a binomial queue.

Parameters
cComparator instance to use.
aAllocator delegate instance.

Member Function Documentation

◆ get()

T get ( )
inline

References elm::io::p().

◆ head()

const T& head ( ) const
inline

◆ isEmpty()

bool isEmpty ( ) const
inline

◆ put()

void put ( const T &  x)
inline

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