Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Gen_B_Tree< Key, Compare, MinDegree > Class Template Reference

Generic B-Tree with configurable minimum degree. More...

#include <tpl_b_tree.H>

Collaboration diagram for Aleph::Gen_B_Tree< Key, Compare, MinDegree >:
[legend]

Public Types

using key_type = Key
 Stored key type.
 

Public Member Functions

 Gen_B_Tree (const Compare &cmp=Compare())
 Construct an empty B-Tree.
 
template<std::input_iterator It>
 Gen_B_Tree (It first, It last, const Compare &cmp=Compare())
 Construct a B-Tree from an iterator range.
 
 Gen_B_Tree (std::initializer_list< Key > init, const Compare &cmp=Compare())
 Construct a B-Tree from an initializer list.
 
 Gen_B_Tree (const Gen_B_Tree &other)
 Copy constructor performing a deep copy.
 
 Gen_B_Tree (Gen_B_Tree &&other)=default
 Move constructor.
 
Gen_B_Treeoperator= (const Gen_B_Tree &other)
 Copy assignment.
 
Gen_B_Treeoperator= (Gen_B_Tree &&other)=default
 Move assignment.
 
const Compare & key_comp () const noexcept
 Return the comparison object (read-only).
 
const Compare & get_compare () const noexcept
 Return the comparison object (read-only).
 
bool empty () const noexcept
 Return whether the tree has no keys.
 
bool is_empty () const noexcept
 Synonym for empty() in traditional Aleph style.
 
size_t size () const noexcept
 Return the number of stored keys.
 
size_t height () const noexcept
 Return the current tree height.
 
void clear () noexcept
 Remove every key from the tree.
 
bool contains (const Key &key) const
 Return whether a key is present.
 
bool search (const Key &key) const
 Synonym for contains().
 
bool insert (const Key &key)
 Insert a key if it is not already present.
 
bool insert (Key &&key)
 Insert a key by move if it is not already present.
 
bool remove (const Key &key)
 Remove a key if present.
 
std::optional< Key > min_key () const
 Return the minimum key, if any.
 
std::optional< Key > max_key () const
 Return the maximum key, if any.
 
std::optional< Key > lower_bound (const Key &key) const
 Return the first key not less than key.
 
std::optional< Key > upper_bound (const Key &key) const
 Return the first key strictly greater than key.
 
Array< Key > keys () const
 Materialize the tree contents in sorted order.
 
bool verify () const
 Verify structural B-Tree invariants.
 

Private Types

using Node = detail::BTreeNode< Key >
 

Private Member Functions

size_t lower_bound_index (const Array< Key > &keys, const Key &key) const
 
size_t upper_bound_index (const Array< Key > &keys, const Key &key) const
 
bool equals (const Key &lhs, const Key &rhs) const
 
template<std::input_iterator It>
void insert_range (It first, It last)
 
std::unique_ptr< Nodeclone_node (const Node *node) const
 
size_t height_of (const Node *node) const noexcept
 
bool contains_in (const Node *node, const Key &key) const
 
void split_child (Node *parent, const size_t idx)
 
void insert_nonfull (Node *node, const Key &key)
 
std::optional< Key > min_in (const Node *node) const
 
std::optional< Key > max_in (const Node *node) const
 
void borrow_from_prev (Node *parent, const size_t idx)
 
void borrow_from_next (Node *parent, const size_t idx)
 
void merge_children (Node *parent, const size_t idx)
 
size_t ensure_child_has_extra (Node *parent, const size_t idx)
 
bool remove_from (Node *node, const Key &key)
 
void collect_keys (const Node *node, Array< Key > &out) const
 
bool verify_node (const Node *node, const std::optional< Key > &min_key, const std::optional< Key > &max_key, const size_t depth, size_t &leaf_depth, size_t &counted) const
 

Static Private Member Functions

template<typename T , typename U >
static void insert_at (Array< T > &array, const size_t idx, U &&value)
 
template<typename T >
static T erase_at (Array< T > &array, const size_t idx)
 
template<typename T >
static void truncate (Array< T > &array, const size_t new_size)
 
template<typename T >
static void append_copy_range (Array< T > &dst, const Array< T > &src, const size_t from)
 
template<typename T >
static void append_move_range (Array< T > &dst, Array< T > &src, const size_t from)
 

Private Attributes

std::unique_ptr< Noderoot_
 
size_t size_ = 0
 
Compare cmp_
 

Static Private Attributes

static constexpr size_t MaxKeys = 2 * MinDegree - 1
 
static constexpr size_t MinKeys = MinDegree - 1
 

Detailed Description

template<typename Key, class Compare = Aleph::less<Key>, size_t MinDegree = 16>
requires StrictWeakOrder<Compare, Key>
class Aleph::Gen_B_Tree< Key, Compare, MinDegree >

Generic B-Tree with configurable minimum degree.

Gen_B_Tree models an ordered set of unique keys. Unlike the raw binary-tree types in Aleph-w, this container owns its internal nodes and stores keys directly in them, which makes it a higher-level tree suited for page-like branching factors.

Template Parameters
KeyKey type stored in the tree.
CompareStrict weak ordering used to sort keys.
MinDegreeMinimum degree t of the B-Tree. Valid values are t >= 2.
Complexity
Example
tree.insert(40);
tree.insert(10);
tree.insert(90);
if (tree.contains(10))
std::cout << "found\n";
tree.remove(40);
auto ordered = tree.keys();
Generic B-Tree with configurable minimum degree.
Definition tpl_b_tree.H:134
bool remove(const Key &key)
Remove a key if present.
Definition tpl_b_tree.H:768
bool insert(const Key &key)
Insert a key if it is not already present.
Definition tpl_b_tree.H:723
bool contains(const Key &key) const
Return whether a key is present.
Definition tpl_b_tree.H:700
Array< Key > keys() const
Materialize the tree contents in sorted order.
Definition tpl_b_tree.H:877
Divide_Conquer_DP_Result< Cost > divide_and_conquer_partition_dp(const size_t groups, const size_t n, Transition_Cost_Fn transition_cost, const Cost inf=dp_optimization_detail::default_inf< Cost >())
Optimize partition DP using divide-and-conquer optimization.
Note
This tree stores unique keys. Duplicate inserts return false.
For leaf-linked range scans, see Aleph::BPlus_Tree.
Thread Safety
Instances are not synchronized. Concurrent access to the same tree requires external synchronization.
Exception Safety
Read-only operations do not allocate. Mutating operations preserve the tree invariants if Compare and Key operations do not throw in the middle of internal node updates; allocation failures propagate as std::bad_alloc.

Definition at line 133 of file tpl_b_tree.H.

Member Typedef Documentation

◆ key_type

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
using Aleph::Gen_B_Tree< Key, Compare, MinDegree >::key_type = Key

Stored key type.

Definition at line 554 of file tpl_b_tree.H.

◆ Node

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
using Aleph::Gen_B_Tree< Key, Compare, MinDegree >::Node = detail::BTreeNode<Key>
private

Definition at line 138 of file tpl_b_tree.H.

Constructor & Destructor Documentation

◆ Gen_B_Tree() [1/5]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
Aleph::Gen_B_Tree< Key, Compare, MinDegree >::Gen_B_Tree ( const Compare &  cmp = Compare())
inlineexplicit

Construct an empty B-Tree.

Parameters
cmpComparison functor used to sort keys.
Exceptions
Nothing.
Note
O(1).

Definition at line 561 of file tpl_b_tree.H.

◆ Gen_B_Tree() [2/5]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
template<std::input_iterator It>
Aleph::Gen_B_Tree< Key, Compare, MinDegree >::Gen_B_Tree ( It  first,
It  last,
const Compare &  cmp = Compare() 
)
inline

Construct a B-Tree from an iterator range.

Parameters
firstFirst element to insert.
lastOne-past-the-end iterator.
cmpComparison functor used to sort keys.
Exceptions
std::bad_allocif internal storage allocation fails.
Note
O(m log m) where m = distance(first, last).

Definition at line 570 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_range().

◆ Gen_B_Tree() [3/5]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
Aleph::Gen_B_Tree< Key, Compare, MinDegree >::Gen_B_Tree ( std::initializer_list< Key >  init,
const Compare &  cmp = Compare() 
)
inline

Construct a B-Tree from an initializer list.

Parameters
initKeys to insert.
cmpComparison functor used to sort keys.
Exceptions
std::bad_allocif internal storage allocation fails.
Note
O(m log m) where m = init.size().

Definition at line 581 of file tpl_b_tree.H.

◆ Gen_B_Tree() [4/5]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
Aleph::Gen_B_Tree< Key, Compare, MinDegree >::Gen_B_Tree ( const Gen_B_Tree< Key, Compare, MinDegree > &  other)
inline

Copy constructor performing a deep copy.

Parameters
otherTree to copy.
Exceptions
std::bad_allocif cloning internal nodes fails.
Note
O(n) time and space.

Definition at line 590 of file tpl_b_tree.H.

◆ Gen_B_Tree() [5/5]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
Aleph::Gen_B_Tree< Key, Compare, MinDegree >::Gen_B_Tree ( Gen_B_Tree< Key, Compare, MinDegree > &&  other)
default

Move constructor.

Parameters
otherTree to move from.
Note
O(1).

Member Function Documentation

◆ append_copy_range()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
template<typename T >
static void Aleph::Gen_B_Tree< Key, Compare, MinDegree >::append_copy_range ( Array< T > &  dst,
const Array< T > &  src,
const size_t  from 
)
inlinestaticprivate

◆ append_move_range()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
template<typename T >
static void Aleph::Gen_B_Tree< Key, Compare, MinDegree >::append_move_range ( Array< T > &  dst,
Array< T > &  src,
const size_t  from 
)
inlinestaticprivate

◆ borrow_from_next()

◆ borrow_from_prev()

◆ clear()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
void Aleph::Gen_B_Tree< Key, Compare, MinDegree >::clear ( )
inlinenoexcept

Remove every key from the tree.

Exceptions
Nothing.
Note
O(n).

Definition at line 688 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.

◆ clone_node()

◆ collect_keys()

◆ contains()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains ( const Key &  key) const
inline

Return whether a key is present.

Parameters
keyKey to search.
Returns
true if the key exists, otherwise false.
Exceptions
Anyexception propagated by Compare.
Note
O(log n).

Definition at line 700 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains_in(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.

Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::search().

◆ contains_in()

◆ empty()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::empty ( ) const
inlinenoexcept

Return whether the tree has no keys.

Returns
true if empty, otherwise false.
Exceptions
Nothing.
Note
O(1).

Definition at line 649 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.

Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::is_empty().

◆ ensure_child_has_extra()

◆ equals()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::equals ( const Key &  lhs,
const Key &  rhs 
) const
inlineprivate

◆ erase_at()

◆ get_compare()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
const Compare & Aleph::Gen_B_Tree< Key, Compare, MinDegree >::get_compare ( ) const
inlinenoexcept

Return the comparison object (read-only).

Returns
Constant reference to the comparison functor.
Note
Alias for key_comp(). Immutable after construction.
Exceptions
Nothing.

Definition at line 639 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::key_comp().

◆ height()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
size_t Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height ( ) const
inlinenoexcept

Return the current tree height.

Returns
0 for an empty tree, otherwise the number of node levels.
Exceptions
Nothing.
Note
O(log n).

Definition at line 679 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height_of(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.

Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height_of().

◆ height_of()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
size_t Aleph::Gen_B_Tree< Key, Compare, MinDegree >::height_of ( const Node node) const
inlineprivatenoexcept

◆ insert() [1/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert ( const Key &  key)
inline

Insert a key if it is not already present.

Parameters
keyKey to insert.
Returns
true if insertion happened, false if it was duplicate.
Exceptions
std::bad_allocif node growth fails.
Anyexception propagated by Compare or Key copy/move operations.
Note
O(log n).

Definition at line 723 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_nonfull(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MaxKeys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::split_child().

Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_range().

◆ insert() [2/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert ( Key &&  key)
inline

Insert a key by move if it is not already present.

Parameters
keyKey to insert.
Returns
true if insertion happened, false if it was duplicate.
Exceptions
std::bad_allocif node growth fails.
Anyexception propagated by Compare or Key move/copy operations.
Note
O(log n).

Definition at line 756 of file tpl_b_tree.H.

References Aleph::copy(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert().

◆ insert_at()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
template<typename T , typename U >
static void Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_at ( Array< T > &  array,
const size_t  idx,
U &&  value 
)
inlinestaticprivate

◆ insert_nonfull()

◆ insert_range()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
template<std::input_iterator It>
void Aleph::Gen_B_Tree< Key, Compare, MinDegree >::insert_range ( It  first,
It  last 
)
inlineprivate

◆ is_empty()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::is_empty ( ) const
inlinenoexcept

Synonym for empty() in traditional Aleph style.

Returns
true if empty, otherwise false.
Exceptions
Nothing.
Note
O(1).

Definition at line 659 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::empty().

◆ key_comp()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
const Compare & Aleph::Gen_B_Tree< Key, Compare, MinDegree >::key_comp ( ) const
inlinenoexcept

Return the comparison object (read-only).

Returns
Constant reference to the comparison functor.
Note
The comparator is immutable after construction to preserve tree order.
Exceptions
Nothing.

Definition at line 629 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_.

Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::get_compare().

◆ keys()

◆ lower_bound()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
std::optional< Key > Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound ( const Key &  key) const
inline

Return the first key not less than key.

Parameters
keyProbe key.
Returns
Matching lower bound or std::nullopt if none exists.
Exceptions
Anyexception propagated by Compare or Key copy construction.
Note
O(log n).

Definition at line 829 of file tpl_b_tree.H.

References Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BTreeNode< Key >::keys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::lower_bound_index(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Array< T >::size().

◆ lower_bound_index()

◆ max_in()

◆ max_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
std::optional< Key > Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_key ( ) const
inline

Return the maximum key, if any.

Returns
Largest key in the tree or std::nullopt if empty.
Exceptions
Anyexception propagated by Key copy construction.
Note
O(log n).

Definition at line 818 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::max_in(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.

Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().

◆ merge_children()

◆ min_in()

◆ min_key()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
std::optional< Key > Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_key ( ) const
inline

Return the minimum key, if any.

Returns
Smallest key in the tree or std::nullopt if empty.
Exceptions
Anyexception propagated by Key copy construction.
Note
O(log n).

Definition at line 808 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::min_in(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_.

Referenced by Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().

◆ operator=() [1/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
Gen_B_Tree & Aleph::Gen_B_Tree< Key, Compare, MinDegree >::operator= ( const Gen_B_Tree< Key, Compare, MinDegree > &  other)
inline

Copy assignment.

Parameters
otherTree to copy from.
Returns
*this.
Note
O(n) time and space (copy-and-swap).

Definition at line 603 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::cmp_, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.

◆ operator=() [2/2]

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
Gen_B_Tree & Aleph::Gen_B_Tree< Key, Compare, MinDegree >::operator= ( Gen_B_Tree< Key, Compare, MinDegree > &&  other)
default

Move assignment.

Parameters
otherTree to move from.
Returns
*this.
Note
O(1).

◆ remove()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove ( const Key &  key)
inline

Remove a key if present.

Parameters
keyKey to erase.
Returns
true if the key was removed, otherwise false.
Exceptions
Anyexception propagated by Compare or Key assignments.
Note
O(log n).

Definition at line 768 of file tpl_b_tree.H.

References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::remove_from(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.

◆ remove_from()

◆ search()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::search ( const Key &  key) const
inline

Synonym for contains().

Parameters
keyKey to search.
Returns
true if the key exists, otherwise false.
Exceptions
Anyexception propagated by Compare.
Note
O(log n).

Definition at line 711 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::contains().

◆ size()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
size_t Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size ( ) const
inlinenoexcept

Return the number of stored keys.

Returns
Number of unique keys stored in the tree.
Exceptions
Nothing.
Note
O(1).

Definition at line 669 of file tpl_b_tree.H.

References Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_.

◆ split_child()

◆ truncate()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
template<typename T >
static void Aleph::Gen_B_Tree< Key, Compare, MinDegree >::truncate ( Array< T > &  array,
const size_t  new_size 
)
inlinestaticprivate

◆ upper_bound()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
std::optional< Key > Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound ( const Key &  key) const
inline

Return the first key strictly greater than key.

Parameters
keyProbe key.
Returns
Matching upper bound or std::nullopt if none exists.
Exceptions
Anyexception propagated by Compare or Key copy construction.
Note
O(log n).

Definition at line 853 of file tpl_b_tree.H.

References Aleph::detail::BTreeNode< Key >::children, Aleph::divide_and_conquer_partition_dp(), Aleph::detail::BTreeNode< Key >::keys, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::keys(), Aleph::detail::BTreeNode< Key >::leaf, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, Aleph::Array< T >::size(), and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound_index().

◆ upper_bound_index()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
size_t Aleph::Gen_B_Tree< Key, Compare, MinDegree >::upper_bound_index ( const Array< Key > &  keys,
const Key &  key 
) const
inlineprivate

◆ verify()

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
bool Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify ( ) const
inline

Verify structural B-Tree invariants.

Returns
true if the tree is structurally valid, otherwise false.
Exceptions
Anyexception propagated by Compare.
Note
O(n).

Definition at line 890 of file tpl_b_tree.H.

References Aleph::and, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_B_Tree< Key, Compare, MinDegree >::root_, Aleph::Gen_B_Tree< Key, Compare, MinDegree >::size_, and Aleph::Gen_B_Tree< Key, Compare, MinDegree >::verify_node().

◆ verify_node()

Member Data Documentation

◆ cmp_

◆ MaxKeys

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
constexpr size_t Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MaxKeys = 2 * MinDegree - 1
staticconstexprprivate

◆ MinKeys

template<typename Key , class Compare = Aleph::less<Key>, size_t MinDegree = 16>
constexpr size_t Aleph::Gen_B_Tree< Key, Compare, MinDegree >::MinKeys = MinDegree - 1
staticconstexprprivate

◆ root_

◆ size_


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