ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
BucketQueue.h

A priority queue for small nonnegative integer keys, beyond the book. More...

Files

file  ADS/priority/BucketQueue.h
 A priority queue for small nonnegative integer keys, beyond the book: a two-level bucket queue, whose outer level is a vector indexed by the first key \( f \) and whose inner one, for each \( f \), a set of LIFO lists, one per second key \( g \).

Concepts

concept  ADS::BucketTie
 a policy of the ties of BucketQueue: whether the least \( g \) comes first

Classes

struct  ADS::LargestSecondKey
 the order of BucketQueue among the items of one \( f \): the largest \( g \) first (A*, toward the deeper nodes), the default More...
struct  ADS::LeastSecondKey
 the order of BucketQueue among the items of one \( f \): the least \( g \) first, i.e., the lexicographic order of the pairs \( ( f , g ) \) (the keys of LPA*) More...
class  ADS::BucketQueue< T, K, Tie, Policy >
 a two-level bucket queue: least \( f \) first, then largest (or, by the policy Tie, least) \( g \), then LIFO More...
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 ) \). More...

Functions

constexpr std::uint64_t ADS::packFG (std::uint32_t f, std::uint32_t g) noexcept
 the key of 64 bits of the pair \( ( f , g ) \), \( f \) in the high half and the complement of \( g \) in the low one, so that the keys under std::less come by least \( f \) and then largest \( g \), the order of a BucketQueue
constexpr std::uint32_t ADS::keyF (std::uint64_t k) noexcept
 the \( f \) of a key of packFG()
constexpr std::uint32_t ADS::keyG (std::uint64_t k) noexcept
 the \( g \) of a key of packFG()

Detailed description

A priority queue for small nonnegative integer keys, beyond the book.

The definitions, the invariants and the costs of the area are in Theory of priority queues.

Function documentation

◆ keyF()

std::uint32_t ADS::keyF ( std::uint64_t k)
nodiscardconstexprnoexcept

the \( f \) of a key of packFG()

◆ keyG()

std::uint32_t ADS::keyG ( std::uint64_t k)
nodiscardconstexprnoexcept

the \( g \) of a key of packFG()

◆ packFG()

std::uint64_t ADS::packFG ( std::uint32_t f,
std::uint32_t g )
nodiscardconstexprnoexcept

the key of 64 bits of the pair \( ( f , g ) \), \( f \) in the high half and the complement of \( g \) in the low one, so that the keys under std::less come by least \( f \) and then largest \( g \), the order of a BucketQueue