ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
ADS::JoinTree< K, V, B, G, Policy, A > Class Template Reference

a DICTIONARY on a binary search tree balanced by the join of B alone, augmented by G, whose changes go to the observers of the subject policy Policy [see Modification.h] More...

#include <ADS/tree/JoinTree.h>

Inheritance diagram for ADS::JoinTree< K, V, B, G, Policy, A >:
ADS::Joinable< JoinTree< K, V, B, G, Policy, A >, JoinTreeNodes< K, V, B, G, Policy, A >, K, V >

Classes

struct  Node
 a node: what the navigation below reads More...
struct  Shape
 the shape of the tree, for PathIterator More...

Public types

using Key = K
 the type of the keys
using Value = V
 the type of the values
using AugValue = typename G::Value
 the type of the augmentation
using Augmented = G
 the augmentation
using allocator_type = A
 the allocator of the nodes
using Inserted = mod::Inserted< K , K , V >
 the insertion of a key, whose handle is the key itself
using Erased = mod::Erased< K , K , V >
 the removal of a key, told before it is made outside a batch
using Assigned = mod::Assigned< K , V >
 the value of a key that is there changed
using modifications
 the events: Cleared by clear() and on the trees that a bulk operation consumes, Rebuilt on the tree that it leaves
using Subject = typename Policy::template bind< modifications , JoinTree >
 the subject [see Modification.h]
using value_type = std::pair< K , V >
 the pairs ( key , value ) by value, which own their copies
using key_type = K
 the type of the keys
using mapped_type = V
 the type of the values
using size_type = std::size_t
 the type of the sizes
using difference_type = std::ptrdiff_t
 the type of the distances
using reference = PairRef< const K & , const V & >
 references, by value
using const_reference = reference
 the same
using const_iterator = PathIterator< JoinTree , Shape >
 the constant iterator by increasing key, along the path from the root
using iterator = const_iterator
 the constant iterator

Public member functions

allocator_type get_allocator (void) const
 the allocator of the nodes, stateless
 JoinTree (std::uint64_t seed=1)
 an empty tree; the seed of the priorities, for a treap
template<class... O>
requires ( sizeof...( O ) > 0 )
 JoinTree (std::uint64_t seed, O &... o)
 an empty tree whose changes go to the static observers o... of the policy; the seed of the priorities, for a treap
 JoinTree (const JoinTree &o)
 a copy, node by node with the same shape, in \( O( n ) \) time, with no observer (none of a policy with static observers, by a static assertion)
 JoinTree (JoinTree &&o) noexcept
 the nodes of o, which is left empty (and tells Cleared), in \( O( 1 ) \) time, with no observer
JoinTree & operator= (JoinTree o) noexcept
 the nodes of o, by copy and swap
 ~JoinTree ()
 frees the nodes
void swap (JoinTree &o) noexcept
 exchanges the nodes with o; the observers of both get Rebuilt
Subject & subject (void)
 the subject, for ADS::batch() and ADS::quiet()
const Subject & subject (void) const
 the subject
std::optional< V > lookup (const K &k) const
 the value of \( k \), or nothing, by the descent of a binary search tree, in \( O( \log n ) \) time
void insert (const K &k, const V &v)
 associates \( v \) to \( k \), in \( O( \log n ) \) time; tells Inserted, or Assigned if \( k \) was there (by one more descent, only when someone listens)
void remove (const K &k)
 removes \( k \), if it is there, in \( O( \log n ) \) time; tells Erased (by one more descent, only when someone listens)
bool assign (const K &k, const V &v)
 the value of \( k \) set to \( v \), and true, if \( k \) is there, nothing and false otherwise, in \( O( \log n ) \) time; the shape stays, and the augmented values of the path to \( k \) change by one combination each with the difference of the old and the new value when G is an abelian group of exact values (commutative and inverse()), by the recomputation of the value of each node from its children otherwise; tells Assigned
bool contains (const K &k) const
 true if \( k \) is there
std::optional< std::pair< K, V > > lowerBound (const K &k) const
 the smallest key not smaller than \( k \) and its value, or nothing (the find( x ) of an SSet of Morin), in \( O( \log n ) \) time
const K * findKey (const K &k) const
 the address of the key \( k \), nil if absent, in \( O( \log n ) \) time: the find( x ) of a USet of Morin [see DictionarySet]; valid until the key is removed
const K * lowerBoundKey (const K &k) const
 the address of the smallest key not smaller than \( k \), nil if none, in \( O( \log n ) \) time: the find( x ) of an SSet of Morin [see DictionarySet]; valid until the key is removed
std::size_t size (void) const
 the number \( n \) of keys
bool empty (void) const
 true if there is no key
void clear (void)
 removes all the pairs; tells Cleared if there was one
int height (void) const
 the height of the tree, -1 if empty, in \( O( n ) \) time
template<class F>
void forEach (F &&f) const
 f( k , v ) on the pairs by increasing keys
AugValue augValue (void) const
 the augmented value of the whole map, in \( O( 1 ) \) time
AugValue augRange (const K &lo, const K &hi) const
 the augmented value of the pairs with keys in \( [ \mathit{lo} , \mathit{hi} ] \), in \( O( \log n ) \) calls of combine(), the combination of the pieces of augVisit()
AugValue augPrefix (const K &k) const
 the augmented value of the pairs with keys \( \le k \), in \( O( \log n ) \) calls of combine()
template<class F>
void augVisit (const K &lo, const K &hi, F &&f) const
 f( a ) on the augmented values \( a \) of the \( O( \log n ) \) pieces (whole subtrees and single pairs) whose union is the set of the keys in \( [ \mathit{lo} , \mathit{hi} ] \), by increasing keys
template<class P>
std::optional< std::pair< K, V > > augSelect (P &&p) const
 the first pair, by increasing keys, whose prefix (the augmented value of the pairs up to it) satisfies \( p \), or nothing, in \( O( \log n ) \) calls of combine() and of \( p \): e.g., the \( i \)-th key, \( p( a ) = a \ge i \) on the sums of values 1, and the first prefix whose sum reaches a threshold
template<class Q, class F>
void augFilter (Q &&q, F &&f) const
 f( k , v ) on the pairs \( ( k , v ) \) with \( q( \mathrm{from}( k , v ) ) \), by increasing keys, entering only the subtrees whose augmented value satisfies \( q \): for \( m \) such pairs on a tree of height \( h \), at most \( 3 m ( h + 1 ) + 1 \) calls of \( q \), i.e., \( O( 1 + m \log n ) \)
const Node * root (void) const
 the root, nullptr if empty; the nodes must not be changed
const_iterator begin (void) const
 the iterator on the smallest key
const_iterator end (void) const
 the iterator past the largest key
const_iterator cbegin (void) const
 as begin()
const_iterator cend (void) const
 as end()
Public member functions inherited from ADS::Joinable< JoinTree< K, V, B, G, Policy, A >, JoinTreeNodes< K, V, B, G, Policy, A >, K, V >
std::tuple< JoinTree< K, V, B, G, Policy, A >, std::optional< V >, JoinTree< K, V, B, G, Policy, A > > split (const K &k) &&
 the keys before \( k \), the value of \( k \) (if there), the keys after \( k \), by JoinAlgorithms::split(); the tree is consumed, in \( O( \log n ) \) time
JoinTree< K, V, B, G, Policy, A > extractRange (const K &lo, const K &hi)
 the pairs of the keys in \( [ \mathit{lo} , \mathit{hi} ] \), taken out of the tree by JoinAlgorithms::extract(), in \( O( \log n ) \) time
void unionWith (JoinTree< K, V, B, G, Policy, A > &&o, F f=F())
 the union with o, which is consumed, by JoinAlgorithms::unite(); on a key of both, the value f( mine , its ), by default its; \( O( m \log( n / m + 1 ) ) \) work for sizes \( m \le n \)
void intersectWith (JoinTree< K, V, B, G, Policy, A > &&o, F f=F())
 the intersection with o, which is consumed, by JoinAlgorithms::intersect(); the value f( mine , its ), by default mine; the work of unionWith(), plus the freeing of the nodes that leave
void differenceWith (JoinTree< K, V, B, G, Policy, A > &&o)
 the keys not in o, which is consumed, by JoinAlgorithms::subtract(); the work of unionWith(), plus the freeing of the nodes of o
void multiInsert (std::span< const std::pair< K, V > > B, F f=F())
 the pairs of \( B \) inserted, by JoinAlgorithms::multiInsert(); on a key already there, the value f( mine , new ), by default new; \( O( m \log( n / m + 1 ) ) \) work for \( m \) pairs
void multiRemove (std::span< const K > B)
 the keys of \( B \) removed, by JoinAlgorithms::multiRemove(), \( O( m \log( n / m + 1 ) ) \) work
void filter (P p)
 only the pairs with p( k , v ) kept, by JoinAlgorithms::filter(), \( O( n ) \) work
U mapReduce (M map, R reduce, U id) const
 \( \mathrm{reduce}( \ldots \mathrm{reduce}( \mathit{id} , \mathrm{map}( k_1 , v_1 ) ) \ldots , \mathrm{map}( k_n , v_n ) ) \) by an associative reduce of identity id, by JoinAlgorithms::mapReduce(), \( O( n ) \) work

Friends

struct JoinTreeNodes< K, V, B, G, Policy, A >

Additional Inherited Members

Static public member functions inherited from ADS::Joinable< JoinTree< K, V, B, G, Policy, A >, JoinTreeNodes< K, V, B, G, Policy, A >, K, V >
static JoinTree< K, V, B, G, Policy, A > join (JoinTree< K, V, B, G, Policy, A > &&l, const K &k, const V &v, JoinTree< K, V, B, G, Policy, A > &&r)
 the tree of the keys of \( l \), the pair \( ( k , v ) \) and the keys of \( r \), by the join of the scheme; \( l \) and \( r \) are consumed, in \( O( | \log n_l - \log n_r | + 1 ) \) time
static JoinTree< K, V, B, G, Policy, A > join2 (JoinTree< K, V, B, G, Policy, A > &&l, JoinTree< K, V, B, G, Policy, A > &&r)
 the tree of the keys of \( l \) and of \( r \), which are consumed, by JoinAlgorithms::join2(), in \( O( \log n ) \) time

Detailed description

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
requires Augmentation< G , K , V >
class ADS::JoinTree< K, V, B, G, Policy, A >

a DICTIONARY on a binary search tree balanced by the join of B alone, augmented by G, whose changes go to the observers of the subject policy Policy [see Modification.h]

Member typedef documentation

◆ allocator_type

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::allocator_type = A

the allocator of the nodes

◆ Assigned

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::Assigned = mod::Assigned< K , V >

the value of a key that is there changed

◆ Augmented

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::Augmented = G

the augmentation

◆ AugValue

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::AugValue = typename G::Value

the type of the augmentation

◆ const_iterator

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::const_iterator = PathIterator< JoinTree , Shape >

the constant iterator by increasing key, along the path from the root

◆ const_reference

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::const_reference = reference

the same

◆ difference_type

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::difference_type = std::ptrdiff_t

the type of the distances

◆ Erased

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::Erased = mod::Erased< K , K , V >

the removal of a key, told before it is made outside a batch

◆ Inserted

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::Inserted = mod::Inserted< K , K , V >

the insertion of a key, whose handle is the key itself

◆ iterator

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::iterator = const_iterator

the constant iterator

◆ Key

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::Key = K

the type of the keys

◆ key_type

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::key_type = K

the type of the keys

◆ mapped_type

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::mapped_type = V

the type of the values

◆ modifications

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::modifications
Initial value:
a list of types, the events of a structure [see Modification.h]
Definition Modification.h:482

the events: Cleared by clear() and on the trees that a bulk operation consumes, Rebuilt on the tree that it leaves

◆ reference

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::reference = PairRef< const K & , const V & >

references, by value

◆ size_type

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::size_type = std::size_t

the type of the sizes

◆ Subject

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::Subject = typename Policy::template bind< modifications , JoinTree >

the subject [see Modification.h]

◆ Value

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::Value = V

the type of the values

◆ value_type

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
using ADS::JoinTree< K, V, B, G, Policy, A >::value_type = std::pair< K , V >

the pairs ( key , value ) by value, which own their copies

Constructor and destructor documentation

◆ JoinTree() [1/4]

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
ADS::JoinTree< K, V, B, G, Policy, A >::JoinTree ( std::uint64_t seed = 1)
explicit

an empty tree; the seed of the priorities, for a treap

◆ JoinTree() [2/4]

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
template<class... O>
requires ( sizeof...( O ) > 0 )
ADS::JoinTree< K, V, B, G, Policy, A >::JoinTree ( std::uint64_t seed,
O &... o )

an empty tree whose changes go to the static observers o... of the policy; the seed of the priorities, for a treap

◆ JoinTree() [3/4]

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
ADS::JoinTree< K, V, B, G, Policy, A >::JoinTree ( const JoinTree< K, V, B, G, Policy, A > & o)

a copy, node by node with the same shape, in \( O( n ) \) time, with no observer (none of a policy with static observers, by a static assertion)

◆ JoinTree() [4/4]

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
ADS::JoinTree< K, V, B, G, Policy, A >::JoinTree ( JoinTree< K, V, B, G, Policy, A > && o)
noexcept

the nodes of o, which is left empty (and tells Cleared), in \( O( 1 ) \) time, with no observer

◆ ~JoinTree()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
ADS::JoinTree< K, V, B, G, Policy, A >::~JoinTree ( )

frees the nodes

Member function documentation

◆ assign()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
bool ADS::JoinTree< K, V, B, G, Policy, A >::assign ( const K & k,
const V & v )

the value of \( k \) set to \( v \), and true, if \( k \) is there, nothing and false otherwise, in \( O( \log n ) \) time; the shape stays, and the augmented values of the path to \( k \) change by one combination each with the difference of the old and the new value when G is an abelian group of exact values (commutative and inverse()), by the recomputation of the value of each node from its children otherwise; tells Assigned

In pseudocode (beyond the book), \( \otimes \) the operation of G and \( T \) the root:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{assign}( k , v ) \cr 2 & \quad u \gets \text{the node of } k \text{, by the descent from } T;\ \textbf{if}\ u = \textbf{nil}\ \textbf{then return} \ \mathit{false} \cr 3 & \quad \textbf{if}\ G \text{ is an abelian group of exact values} \ \textbf{then} \cr 4 & \qquad d \gets \mathrm{from}( k , v ) \otimes \mathrm{from}( k , u.v )^{-1} \cr 5 & \qquad \textbf{foreach}\ x \text{ on the path from } T \text{ to } u\ \textbf{do}\ \mathit{aug}( x ) \gets \mathit{aug}( x ) \otimes d \cr 6 & \qquad u.v \gets v \cr 7 & \quad \textbf{else} \cr 8 & \qquad u.v \gets v \cr 9 & \qquad \textbf{foreach}\ x \text{ on the path from } u \text{ to } T\ \textbf{do}\ \mathit{aug}( x ) \gets \mathit{aug}( x.\mathit{left} ) \otimes \mathrm{from}( x ) \otimes \mathit{aug}( x.\mathit{right} ) \cr 10 & \quad \textbf{return}\ \mathit{true} \end{array}} \]

Postcondition
if true, \( k \) has the value \( v \)

◆ augFilter()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
template<class Q, class F>
void ADS::JoinTree< K, V, B, G, Policy, A >::augFilter ( Q && q,
F && f ) const

f( k , v ) on the pairs \( ( k , v ) \) with \( q( \mathrm{from}( k , v ) ) \), by increasing keys, entering only the subtrees whose augmented value satisfies \( q \): for \( m \) such pairs on a tree of height \( h \), at most \( 3 m ( h + 1 ) + 1 \) calls of \( q \), i.e., \( O( 1 + m \log n ) \)

In pseudocode (Sun, Ferizovic and Blelloch, beyond the book), from \( u = T \):

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{augFilter}( u , q , f ) \cr 2 & \quad \textbf{if}\ u = \textbf{nil}\ \textbf{or not}\ q( \mathit{aug}( u ) )\ \textbf{then return} \cr 3 & \quad \mathrm{augFilter}( u.\mathit{left} , q , f ) \cr 4 & \quad \textbf{if}\ q( \mathrm{from}( u ) )\ \textbf{then}\ f( u.\mathit{key} , u.v ) \cr 5 & \quad \mathrm{augFilter}( u.\mathit{right} , q , f ) \end{array}} \]

Precondition
\( q \) is false on the identity and \( q( a \otimes b ) = q( a ) \lor q( b ) \) (e.g., \( q( a ) = a \ge \theta \) on the maxima)

◆ augPrefix()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
AugValue ADS::JoinTree< K, V, B, G, Policy, A >::augPrefix ( const K & k) const
nodiscard

the augmented value of the pairs with keys \( \le k \), in \( O( \log n ) \) calls of combine()

In pseudocode (Sun, Ferizovic and Blelloch, beyond the book), on the path to \( k \):

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{augPrefix}( k ) \cr 2 & \quad a \gets \mathrm{identity}();\ u \gets T \cr 3 & \quad \textbf{while}\ u \ne \textbf{nil}\ \textbf{do} \cr 4 & \qquad \textbf{if}\ k < u.\mathit{key}\ \textbf{then}\ u \gets u.\mathit{left} \cr 5 & \qquad \textbf{else}\ a \gets a \otimes \mathit{aug}( u.\mathit{left} ) \otimes \mathrm{from}( u );\ u \gets u.\mathit{right} \cr 6 & \quad \textbf{return}\ a \end{array}} \]

◆ augRange()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
AugValue ADS::JoinTree< K, V, B, G, Policy, A >::augRange ( const K & lo,
const K & hi ) const
nodiscard

the augmented value of the pairs with keys in \( [ \mathit{lo} , \mathit{hi} ] \), in \( O( \log n ) \) calls of combine(), the combination of the pieces of augVisit()

◆ augSelect()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
template<class P>
std::optional< std::pair< K, V > > ADS::JoinTree< K, V, B, G, Policy, A >::augSelect ( P && p) const
nodiscard

the first pair, by increasing keys, whose prefix (the augmented value of the pairs up to it) satisfies \( p \), or nothing, in \( O( \log n ) \) calls of combine() and of \( p \): e.g., the \( i \)-th key, \( p( a ) = a \ge i \) on the sums of values 1, and the first prefix whose sum reaches a threshold

In pseudocode (beyond the book), on one descent:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{function}\ \mathrm{augSelect}( p ) \cr 2 & \quad a \gets \mathrm{identity}();\ u \gets T \cr 3 & \quad \textbf{while}\ u \ne \textbf{nil}\ \textbf{do} \cr 4 & \qquad b \gets a \otimes \mathit{aug}( u.\mathit{left} ) \cr 5 & \qquad \textbf{if}\ u.\mathit{left} \ne \textbf{nil}\ \textbf{and} \ p( b )\ \textbf{then}\ u \gets u.\mathit{left}; \ \textbf{continue} \cr 6 & \qquad b \gets b \otimes \mathrm{from}( u ) \cr 7 & \qquad \textbf{if}\ p( b )\ \textbf{then return}\ ( u.\mathit{key} , u.v ) \cr 8 & \qquad a \gets b;\ u \gets u.\mathit{right} \cr 9 & \quad \textbf{return}\ \textbf{nil} \end{array}} \]

Precondition
\( p \) is monotone on the prefixes: if it holds on the prefix up to a key, it holds on the prefix up to any larger key

◆ augValue()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
AugValue ADS::JoinTree< K, V, B, G, Policy, A >::augValue ( void ) const
nodiscard

the augmented value of the whole map, in \( O( 1 ) \) time

◆ augVisit()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
template<class F>
void ADS::JoinTree< K, V, B, G, Policy, A >::augVisit ( const K & lo,
const K & hi,
F && f ) const

f( a ) on the augmented values \( a \) of the \( O( \log n ) \) pieces (whole subtrees and single pairs) whose union is the set of the keys in \( [ \mathit{lo} , \mathit{hi} ] \), by increasing keys

In pseudocode (Sun, Ferizovic and Blelloch, beyond the book), \( t \) the node where the paths to \( \mathit{lo} \) and to \( \mathit{hi} \) part:

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{augVisit}( \mathit{lo} , \mathit{hi} , f ) \cr 2 & \quad t \gets \text{the first node of the descent from the root } \text{with } \mathit{lo} \le t.\mathit{key} \le \mathit{hi} \cr 3 & \quad \textbf{if}\ t = \textbf{nil}\ \textbf{then return} \cr 4 & \quad P \gets \text{the nodes } u \text{ with } u.\mathit{key} \ge \mathit{lo} \text{ on the path to } \mathit{lo} \text{ in } t.\mathit{left} \cr 5 & \quad \textbf{foreach}\ u \in P \text{, by increasing keys} \ \textbf{do}\ f( \mathrm{from}( u ) );\ f( \mathit{aug}( u.\mathit{right} ) ) \cr 6 & \quad f( \mathrm{from}( t ) ) \cr 7 & \quad \textbf{foreach}\ u \text{ with } u.\mathit{key} \le \mathit{hi} \text{ on the path to } \mathit{hi} \text{ in } t.\mathit{right} \text{, in order}\ \textbf{do} \cr 8 & \qquad f( \mathit{aug}( u.\mathit{left} ) );\ f( \mathrm{from}( u ) ) \end{array}} \]

◆ begin()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const_iterator ADS::JoinTree< K, V, B, G, Policy, A >::begin ( void ) const
inlinenodiscard

the iterator on the smallest key

◆ cbegin()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const_iterator ADS::JoinTree< K, V, B, G, Policy, A >::cbegin ( void ) const
inlinenodiscard

as begin()

◆ cend()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const_iterator ADS::JoinTree< K, V, B, G, Policy, A >::cend ( void ) const
inlinenodiscard

as end()

◆ clear()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
void ADS::JoinTree< K, V, B, G, Policy, A >::clear ( void )

removes all the pairs; tells Cleared if there was one

◆ contains()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
bool ADS::JoinTree< K, V, B, G, Policy, A >::contains ( const K & k) const
nodiscard

true if \( k \) is there

◆ empty()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
bool ADS::JoinTree< K, V, B, G, Policy, A >::empty ( void ) const
nodiscard

true if there is no key

◆ end()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const_iterator ADS::JoinTree< K, V, B, G, Policy, A >::end ( void ) const
inlinenodiscard

the iterator past the largest key

◆ findKey()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const K * ADS::JoinTree< K, V, B, G, Policy, A >::findKey ( const K & k) const
nodiscard

the address of the key \( k \), nil if absent, in \( O( \log n ) \) time: the find( x ) of a USet of Morin [see DictionarySet]; valid until the key is removed

◆ forEach()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
template<class F>
void ADS::JoinTree< K, V, B, G, Policy, A >::forEach ( F && f) const

f( k , v ) on the pairs by increasing keys

◆ get_allocator()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
allocator_type ADS::JoinTree< K, V, B, G, Policy, A >::get_allocator ( void ) const
inlinenodiscard

the allocator of the nodes, stateless

◆ height()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
int ADS::JoinTree< K, V, B, G, Policy, A >::height ( void ) const
nodiscard

the height of the tree, -1 if empty, in \( O( n ) \) time

◆ insert()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
void ADS::JoinTree< K, V, B, G, Policy, A >::insert ( const K & k,
const V & v )

associates \( v \) to \( k \), in \( O( \log n ) \) time; tells Inserted, or Assigned if \( k \) was there (by one more descent, only when someone listens)

In pseudocode (Blelloch, Ferizovic and Sun, beyond the book), the insertion by joins of JoinAlgorithms::insert():

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{insert}( k , v ) \cr 2 & \quad T \gets \mathrm{insert}( T , \text{a node alone of } ( k , v ) ) \end{array}} \]

Postcondition
\( k \) has the value \( v \)

◆ lookup()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
std::optional< V > ADS::JoinTree< K, V, B, G, Policy, A >::lookup ( const K & k) const
nodiscard

the value of \( k \), or nothing, by the descent of a binary search tree, in \( O( \log n ) \) time

◆ lowerBound()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
std::optional< std::pair< K, V > > ADS::JoinTree< K, V, B, G, Policy, A >::lowerBound ( const K & k) const
nodiscard

the smallest key not smaller than \( k \) and its value, or nothing (the find( x ) of an SSet of Morin), in \( O( \log n ) \) time

◆ lowerBoundKey()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const K * ADS::JoinTree< K, V, B, G, Policy, A >::lowerBoundKey ( const K & k) const
nodiscard

the address of the smallest key not smaller than \( k \), nil if none, in \( O( \log n ) \) time: the find( x ) of an SSet of Morin [see DictionarySet]; valid until the key is removed

◆ operator=()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
JoinTree & ADS::JoinTree< K, V, B, G, Policy, A >::operator= ( JoinTree< K, V, B, G, Policy, A > o)
noexcept

the nodes of o, by copy and swap

◆ remove()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
void ADS::JoinTree< K, V, B, G, Policy, A >::remove ( const K & k)

removes \( k \), if it is there, in \( O( \log n ) \) time; tells Erased (by one more descent, only when someone listens)

In pseudocode (Blelloch, Ferizovic and Sun, beyond the book), the removal by joins of JoinAlgorithms::remove():

\[\class{pseudocode}{\begin{array}{r@{\quad}l} 1 & \textbf{procedure}\ \mathrm{remove}( k ) \cr 2 & \quad T \gets \mathrm{remove}( T , k ) \end{array}} \]

Postcondition
\( k \) is not there

◆ root()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const Node * ADS::JoinTree< K, V, B, G, Policy, A >::root ( void ) const
inlinenodiscard

the root, nullptr if empty; the nodes must not be changed

◆ size()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
std::size_t ADS::JoinTree< K, V, B, G, Policy, A >::size ( void ) const
nodiscard

the number \( n \) of keys

◆ subject() [1/2]

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
Subject & ADS::JoinTree< K, V, B, G, Policy, A >::subject ( void )
inlinenodiscard

the subject, for ADS::batch() and ADS::quiet()

◆ subject() [2/2]

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
const Subject & ADS::JoinTree< K, V, B, G, Policy, A >::subject ( void ) const
inlinenodiscard

the subject

◆ swap()

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
void ADS::JoinTree< K, V, B, G, Policy, A >::swap ( JoinTree< K, V, B, G, Policy, A > & o)
noexcept

exchanges the nodes with o; the observers of both get Rebuilt

◆ JoinTreeNodes< K, V, B, G, Policy, A >

template<std::totally_ordered K, class V, class B, class G, class Policy, class A>
friend struct JoinTreeNodes< K, V, B, G, Policy, A >
friend

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