|
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. | |
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 96 of file tpl_tdRbTreeRk.H.
| using Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::compare_type = Compare |
Definition at line 101 of file tpl_tdRbTreeRk.H.
| using Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::key_type = Key |
Definition at line 100 of file tpl_tdRbTreeRk.H.
| using Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::Node = NodeType<Key> |
Definition at line 99 of file tpl_tdRbTreeRk.H.
|
inlinenoexcept |
Default constructor.
Definition at line 690 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init().
|
inlineexplicitnoexcept |
Constructor with comparator.
Definition at line 697 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init().
|
inlinenoexcept |
Move constructor.
Definition at line 704 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::init(), Aleph::maps(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
delete |
|
virtualdefault |
|
inlineprivatenoexcept |
Color root red if safe.
Definition at line 610 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::LLINK(), Aleph::maps(), RED, Aleph::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 118 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, and Aleph::maps().
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 889 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::find_position(), Aleph::maps(), 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 557 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), Aleph::LLINK(), Aleph::maps(), pred, and Aleph::RLINK().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::removeAndRendLeafRed().
|
inlinestaticprivatenoexcept |
Find successor and swap for deletion.
Definition at line 503 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoLeftAndColorRed(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::gotoRightAndColorRed(), Aleph::LLINK(), Aleph::maps(), and Aleph::RLINK().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::removeAndRendLeafRed().
|
inlinestaticprivatenoexcept |
Flip colors with counter preservation.
Definition at line 214 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::LLINK(), Aleph::maps(), RED, and Aleph::RLINK().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
inlinenoexcept |
Definition at line 751 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp.
|
inlinenoexcept |
Get comparator.
Definition at line 750 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp.
|
inlinenoexcept |
Definition at line 861 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Get root pointer.
Definition at line 860 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinestaticprivatenoexcept |
Descend to left child for deletion, ensuring red.
Definition at line 391 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::LLINK(), Aleph::maps(), RED, Aleph::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 447 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::LLINK(), Aleph::maps(), RED, Aleph::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 679 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::COUNT(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::fHead, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::head, and Aleph::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 756 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::maps(), RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert().
|
inlinenoexcept |
Insert a node allowing duplicates.
Definition at line 774 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), Aleph::maps(), RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root, and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
inlinenoexcept |
Check if empty.
Definition at line 747 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlineprivatenoexcept |
Returns true if a < b according to comparator.
Definition at line 112 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp.
|
delete |
|
inlinenoexcept |
Move assignment.
Definition at line 714 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::maps(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Find position of a key.
Definition at line 878 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::inorder_position(), Aleph::maps(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Remove node with given key.
Definition at line 831 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), KEY, Aleph::maps(), 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 901 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 659 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findPredAndSwap(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::findSuccAndSwap(), Aleph::LLINK(), Aleph::maps(), and Aleph::RLINK().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::remove().
|
inlinenoexcept |
Reset tree (does not free nodes)
Definition at line 729 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlineprivatenoexcept |
Restore red-black property after color flip.
Definition at line 168 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::LLINK(), Aleph::maps(), RED, Aleph::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 146 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), Aleph::LLINK(), Aleph::maps(), and Aleph::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 124 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), Aleph::LLINK(), Aleph::maps(), and Aleph::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 814 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::equals(), KEY, Aleph::LLINK(), Aleph::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 792 of file tpl_tdRbTreeRk.H.
References COLOR, Aleph::COUNT(), KEY, Aleph::maps(), 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 621 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::colorRootAsRed(), 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, Aleph::LLINK(), Aleph::maps(), Aleph::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 227 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, 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, Aleph::LLINK(), Aleph::maps(), RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition(), Aleph::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 300 of file tpl_tdRbTreeRk.H.
References BLACK, COLOR, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::fHead, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::flipColors(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::head, KEY, Aleph::LLINK(), Aleph::maps(), RED, Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::restoreRedCondition(), Aleph::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 870 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 744 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 914 of file tpl_tdRbTreeRk.H.
References Aleph::count(), Aleph::maps(), 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 940 of file tpl_tdRbTreeRk.H.
References Aleph::count(), Aleph::DynList< T >::insert(), Aleph::LLINK(), Aleph::maps(), Aleph::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 735 of file tpl_tdRbTreeRk.H.
References Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::maps(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
inlinestaticprivatenoexcept |
Recursively update counts in subtree - O(n)
Definition at line 365 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), Aleph::LLINK(), Aleph::maps(), Aleph::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 379 of file tpl_tdRbTreeRk.H.
References Aleph::COUNT(), Aleph::LLINK(), and Aleph::RLINK().
Referenced by Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsert(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::searchFlipColorsAndInsertDup().
|
inlinenoexcept |
Verify tree properties.
Definition at line 964 of file tpl_tdRbTreeRk.H.
References Aleph::check_rank_tree(), Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::cmp, Aleph::is_red_black_bst_rk(), Aleph::maps(), and Aleph::GenTdRbTreeRk< NodeType, Key, Compare >::root.
|
private |
Comparison functor.
Definition at line 109 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 107 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 106 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 104 of file tpl_tdRbTreeRk.H.
|
private |
Sentinel grandparent node.
Definition at line 105 of file tpl_tdRbTreeRk.H.
|
private |
Reference to root (right child of head)
Definition at line 108 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().