|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Top-down red-black tree with rank support (select/position). More...
#include <tpl_tdRbTreeRk.H>
Classes | |
| struct | Iterator |
| Iterator. More... | |
Public Types | |
| using | Node = NodeType< Key > |
| using | key_type = Key |
| using | compare_type = Compare |
Public Member Functions | |
| GenTdRbTreeRk () noexcept | |
| Default constructor. | |
| GenTdRbTreeRk (const Compare &__cmp) noexcept | |
| Constructor with comparator. | |
| GenTdRbTreeRk (GenTdRbTreeRk &&other) noexcept | |
| Move constructor. | |
| GenTdRbTreeRk & | operator= (GenTdRbTreeRk &&other) noexcept |
| Move assignment. | |
| GenTdRbTreeRk (const GenTdRbTreeRk &)=delete | |
| GenTdRbTreeRk & | operator= (const GenTdRbTreeRk &)=delete |
| void | reset () noexcept |
| Reset tree (does not free nodes) | |
| void | swap (GenTdRbTreeRk &other) noexcept |
| Swap with another tree. | |
| virtual | ~GenTdRbTreeRk ()=default |
| size_t | size () const noexcept |
| Get number of nodes O(1) | |
| bool | is_empty () const noexcept |
| Check if empty. | |
| Compare & | get_compare () noexcept |
| Get comparator. | |
| const Compare & | get_compare () const noexcept |
| Node * | insert (Node *p) noexcept |
| Insert a node. | |
| Node * | insert_dup (Node *p) noexcept |
| Insert a node allowing duplicates. | |
| Node * | search_or_insert (Node *p) noexcept |
| Search or insert. | |
| Node * | search (const Key &key) const noexcept |
| Search for a key. | |
| Node * | remove (const Key &key) noexcept |
| Remove node with given key. | |
| Node *& | getRoot () noexcept |
| Get root pointer. | |
| Node * | getRoot () const noexcept |
| Node * | select (size_t i) const |
| Select i-th node in order. | |
| std::pair< long, Node * > | position (const Key &key) const noexcept |
| Find position of a key. | |
| std::pair< long, Node * > | find_position (const Key &key) const noexcept |
| Find position of a key (even if not in tree). | |
| Node * | remove_pos (size_t i) |
| Remove node at position i. | |
| void | split_pos (size_t pos, GenTdRbTreeRk &t1, GenTdRbTreeRk &t2) noexcept |
| Split tree by position. | |
| bool | verify () const noexcept |
| Verify tree properties. | |
Static Public Attributes | |
| static constexpr size_t | PATH_STACK_CAPACITY = 128 |
Private Member Functions | |
| bool | less (const Key &a, const Key &b) const noexcept |
| Returns true if a < b according to comparator. | |
| bool | equals (const Key &a, const Key &b) const noexcept |
| Returns true if a == b (neither a < b nor b < a) | |
| void | restoreRedCondition (Node *p, Node *&fp, Node *ffp, Node *fffp) noexcept |
| Restore red-black property after color flip. | |
| Node * | searchFlipColorsAndInsert (Node *q) noexcept |
| Search for insertion point, flipping colors proactively. | |
| Node * | searchFlipColorsAndInsertDup (Node *q) noexcept |
| Search for insertion point allowing duplicates. | |
| void | colorRootAsRed () noexcept |
| Color root red if safe. | |
| Node * | searchAndColorRed (const Key &key, Node *&fp, Node **stack, size_t &stack_len) noexcept |
| Search for key while coloring nodes red for deletion. | |
| void | init () noexcept |
| Initialize header nodes. | |
| void | split_pos_inorder (Node *p, size_t pos, GenTdRbTreeRk &t1, GenTdRbTreeRk &t2, size_t &count) noexcept |
Static Private Member Functions | |
| static Node * | rotate_to_right_rk (Node *p, Node *pp) noexcept |
| Rotate to right with counter update. | |
| static Node * | rotate_to_left_rk (Node *p, Node *pp) noexcept |
| Rotate to left with counter update. | |
| static void | flipColors (Node *p) noexcept |
| Flip colors with counter preservation. | |
| static size_t | updateCountRec (Node *p) noexcept |
| Recursively update counts in subtree - O(n) | |
| static void | updateCountsFromStack (Node **stack, size_t len) noexcept |
| Update counts for nodes in stack (bottom-up) - O(log n) After rotations, nodes may have moved but their counts can be recalculated from their current children. | |
| static Node * | gotoLeftAndColorRed (Node *fp, Node *&ffp) noexcept |
| Descend to left child for deletion, ensuring red. | |
| static Node * | gotoRightAndColorRed (Node *fp, Node *&ffp) noexcept |
| Descend to right child for deletion, ensuring red. | |
| static void | findSuccAndSwap (Node *p, Node *&fp) noexcept |
| Find successor and swap for deletion. | |
| static void | findPredAndSwap (Node *p, Node *&fp) noexcept |
| Find predecessor and swap for deletion. | |
| static void | removeAndRendLeafRed (Node *p, Node *fp) noexcept |
| Remove node, making it a red leaf. | |
Private Attributes | |
| Node | headNode |
| Sentinel header node (parent of root) | |
| Node | headParent |
| Sentinel grandparent node. | |
| Node * | head |
| Pointer to header. | |
| Node * | fHead |
| Pointer to header's parent. | |
| Node *& | root |
| Reference to root (right child of head) | |
| Compare | cmp |
| Comparison functor. | |
Top-down red-black tree with rank support (select/position).
This class extends the top-down red-black tree algorithm with subtree counters in each node, enabling O(log n) operations for:
For O(log n) remove with rank, use Rb_Tree_Rk (bottom-up) which tracks the full path during descent.
| NodeType | Node template (typically RbNodeRk or RbNodeRkVtl). |
| Key | The type of keys stored in the tree. |
| Compare | Comparison functor for ordering keys. |
Definition at line 99 of file tpl_tdRbTreeRk.H.
| using Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::compare_type = Compare |
Definition at line 104 of file tpl_tdRbTreeRk.H.
| using Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::key_type = Key |
Definition at line 103 of file tpl_tdRbTreeRk.H.
| using Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::Node = NodeType<Key> |
Definition at line 102 of file tpl_tdRbTreeRk.H.
|
inlinenoexcept |
Default constructor.
Definition at line 696 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init().
|
inlineexplicitnoexcept |
Constructor with comparator.
Definition at line 703 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init().
|
inlinenoexcept |
Move constructor.
Definition at line 710 of file tpl_tdRbTreeRk.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
delete |
|
virtualdefault |
|
inlineprivatenoexcept |
Color root red if safe.
Definition at line 616 of file tpl_tdRbTreeRk.H.
References Aleph::and, BLACK, COLOR, LLINK, RED, RLINK, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed().
|
inlineprivatenoexcept |
Returns true if a == b (neither a < b nor b < a)
Definition at line 124 of file tpl_tdRbTreeRk.H.
References Aleph::and, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, and Aleph::divide_and_conquer_partition_dp().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::search(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert().
|
inlinenoexcept |
Find position of a key (even if not in tree).
Definition at line 895 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::find_position(), r, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::find_position().
|
inlinestaticprivatenoexcept |
Find predecessor and swap for deletion.
Definition at line 563 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), LLINK, pred, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::removeAndRendLeafRed().
|
inlinestaticprivatenoexcept |
Find successor and swap for deletion.
Definition at line 509 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), LLINK, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::removeAndRendLeafRed().
|
inlinestaticprivatenoexcept |
Flip colors with counter preservation.
Definition at line 220 of file tpl_tdRbTreeRk.H.
References Aleph::and, BLACK, COLOR, Aleph::divide_and_conquer_partition_dp(), LLINK, RED, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
inlinenoexcept |
Definition at line 757 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp.
|
inlinenoexcept |
Get comparator.
Definition at line 756 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp.
|
inlinenoexcept |
Definition at line 867 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Get root pointer.
Definition at line 866 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinestaticprivatenoexcept |
Descend to left child for deletion, ensuring red.
Definition at line 397 of file tpl_tdRbTreeRk.H.
References Aleph::and, BLACK, COLOR, Aleph::divide_and_conquer_partition_dp(), LLINK, RED, RLINK, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::rotate_to_left_rk(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::rotate_to_right_rk().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findPredAndSwap(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findSuccAndSwap(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed().
|
inlinestaticprivatenoexcept |
Descend to right child for deletion, ensuring red.
Definition at line 453 of file tpl_tdRbTreeRk.H.
References Aleph::and, BLACK, COLOR, Aleph::divide_and_conquer_partition_dp(), LLINK, RED, RLINK, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::rotate_to_left_rk(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::rotate_to_right_rk().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findPredAndSwap(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findSuccAndSwap(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed().
|
inlineprivatenoexcept |
Initialize header nodes.
Definition at line 685 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::COUNT(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::fHead, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::head, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::GenTdRbTreeRk(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::GenTdRbTreeRk(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::GenTdRbTreeRk().
|
inlinenoexcept |
Insert a node.
Definition at line 762 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert().
|
inlinenoexcept |
Insert a node allowing duplicates.
Definition at line 780 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
inlinenoexcept |
Check if empty.
Definition at line 753 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlineprivatenoexcept |
Returns true if a < b according to comparator.
Definition at line 118 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp.
|
delete |
|
inlinenoexcept |
Move assignment.
Definition at line 720 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::divide_and_conquer_partition_dp(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Find position of a key.
Definition at line 884 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::divide_and_conquer_partition_dp(), Aleph::inorder_position(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Remove node with given key.
Definition at line 837 of file tpl_tdRbTreeRk.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), KEY, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::PATH_STACK_CAPACITY, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::removeAndRendLeafRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::updateCountRec().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove_pos(), and TEST().
|
inline |
Remove node at position i.
| i | Zero-based position. |
Definition at line 907 of file tpl_tdRbTreeRk.H.
References KEY, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::select().
|
inlinestaticprivatenoexcept |
Remove node, making it a red leaf.
Definition at line 665 of file tpl_tdRbTreeRk.H.
References Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findPredAndSwap(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findSuccAndSwap(), LLINK, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove().
|
inlinenoexcept |
Reset tree (does not free nodes)
Definition at line 735 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlineprivatenoexcept |
Restore red-black property after color flip.
Definition at line 174 of file tpl_tdRbTreeRk.H.
References Aleph::and, BLACK, COLOR, Aleph::divide_and_conquer_partition_dp(), LLINK, RED, RLINK, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::rotate_to_left_rk(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::rotate_to_right_rk().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
inlinestaticprivatenoexcept |
Rotate to left with counter update.
Definition at line 152 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), LLINK, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition().
|
inlinestaticprivatenoexcept |
Rotate to right with counter update.
Definition at line 130 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), LLINK, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition().
|
inlinenoexcept |
Search for a key.
Definition at line 820 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), KEY, LLINK, RLINK, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::search_or_insert(), and TEST().
|
inlinenoexcept |
Search or insert.
Definition at line 798 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), KEY, RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::search(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert().
|
inlineprivatenoexcept |
Search for key while coloring nodes red for deletion.
Also collects visited nodes in stack for count updates.
Definition at line 627 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::colorRootAsRed(), Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::fHead, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::head, KEY, LLINK, RLINK, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove().
|
inlineprivatenoexcept |
Search for insertion point, flipping colors proactively.
Uses stack to track path for O(log n) count updates.
Definition at line 233 of file tpl_tdRbTreeRk.H.
References Aleph::and, BLACK, COLOR, Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::fHead, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::flipColors(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::head, KEY, LLINK, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::PATH_STACK_CAPACITY, RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition(), RLINK, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::updateCountsFromStack().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::insert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::search_or_insert().
|
inlineprivatenoexcept |
Search for insertion point allowing duplicates.
Uses stack for O(log n) count updates.
Definition at line 306 of file tpl_tdRbTreeRk.H.
References Aleph::and, BLACK, COLOR, Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::fHead, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::flipColors(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::head, KEY, LLINK, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::PATH_STACK_CAPACITY, RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition(), RLINK, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::updateCountsFromStack().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::insert_dup().
|
inline |
Select i-th node in order.
| i | Zero-based position. |
| out_of_range | if i >= size(). |
Definition at line 876 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, and Aleph::select().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove_pos(), and TEST().
|
inlinenoexcept |
Get number of nodes O(1)
Definition at line 750 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos(), TEST(), and TEST().
|
inlinenoexcept |
Split tree by position.
| pos | Split position. |
| t1 | Receives nodes [0, pos). |
| t2 | Receives nodes [pos, size). |
Definition at line 920 of file tpl_tdRbTreeRk.H.
References Aleph::count(), Aleph::divide_and_conquer_partition_dp(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::size(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos_inorder().
|
inlineprivatenoexcept |
Definition at line 946 of file tpl_tdRbTreeRk.H.
References Aleph::count(), Aleph::divide_and_conquer_partition_dp(), LLINK, RLINK, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos_inorder().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos_inorder().
|
inlinenoexcept |
Swap with another tree.
Definition at line 741 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::divide_and_conquer_partition_dp(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinestaticprivatenoexcept |
Recursively update counts in subtree - O(n)
Definition at line 371 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), Aleph::divide_and_conquer_partition_dp(), LLINK, RLINK, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::updateCountRec().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::updateCountRec().
|
inlinestaticprivatenoexcept |
Update counts for nodes in stack (bottom-up) - O(log n) After rotations, nodes may have moved but their counts can be recalculated from their current children.
Definition at line 385 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), LLINK, and RLINK.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
inlinenoexcept |
Verify tree properties.
Definition at line 970 of file tpl_tdRbTreeRk.H.
References Aleph::and, Aleph::check_rank_tree(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::is_red_black_bst_rk(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
private |
Comparison functor.
Definition at line 115 of file tpl_tdRbTreeRk.H.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::find_position(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::get_compare(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::get_compare(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::less(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::operator=(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::position(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::swap(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::verify().
|
private |
Pointer to header's parent.
Definition at line 113 of file tpl_tdRbTreeRk.H.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
private |
Pointer to header.
Definition at line 112 of file tpl_tdRbTreeRk.H.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
private |
Sentinel header node (parent of root)
Definition at line 110 of file tpl_tdRbTreeRk.H.
|
private |
Sentinel grandparent node.
Definition at line 111 of file tpl_tdRbTreeRk.H.
|
staticconstexpr |
|
private |
Reference to root (right child of head)
Definition at line 114 of file tpl_tdRbTreeRk.H.
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::GenTdRbTreeRk(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::colorRootAsRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::find_position(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::getRoot(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::getRoot(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::insert(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::insert_dup(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::is_empty(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::operator=(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::position(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::reset(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::search(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::search_or_insert(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::select(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::size(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::split_pos(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::swap(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::verify().