|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
AVL balanced binary search tree with rank (order statistics). More...
#include <tpl_avlRk.H>
Classes | |
| class | Iterator |
| Iterator over the nodes. More... | |
Public Types | |
| using | Node = NodeType< Key > |
| using | key_type = Key |
Public Member Functions | |
| constexpr Compare & | key_comp () noexcept |
| The key type. | |
| constexpr Compare & | get_compare () noexcept |
| Gen_Avl_Tree_Rk (Compare cmf_fct=Compare()) noexcept | |
| void | swap (Gen_Avl_Tree_Rk &tree) noexcept |
Swap in constant time all the items of this with the items of tree. | |
| virtual | ~Gen_Avl_Tree_Rk () noexcept |
| constexpr Node *& | getRoot () noexcept |
| Return a modifiable reference to tree's root. | |
| constexpr Node * | getRoot () const noexcept |
| Return a pointer to the tree's root. | |
| size_t | size () const noexcept |
| Return the number of nodes in the tree. | |
| constexpr bool | is_empty () const noexcept |
| Return true if tree is empty. | |
| Node * | search (const Key &key) const noexcept |
Search a node containing key; if found, then a pointer to the node containing it is returned; otherwise nullptr is returned. | |
| Node * | insert (Node *p) noexcept |
| Insert the node pointed by p in the tree. | |
| Node * | search_or_insert (Node *p) noexcept |
| Search or insert a key. | |
| Node * | insert_dup (Node *p) noexcept |
| Insert the node p without testing for key duplicity. | |
| Node * | remove (const Key &key) noexcept |
| Remove from tree the node containing key. | |
| Node * | select (const size_t i) const |
| Return the i-th node in order sense. | |
| std::pair< long, Node * > | position (const Key &key) const noexcept |
| Compute the inorder position of a key. | |
| std::pair< long, Node * > | find_position (const Key &key) const noexcept |
| Find the inorder position of a key in the tree. | |
| bool | verify () const noexcept |
| Return true if the tree is a valid AVL tree with correct counters. | |
| void | join_exclusive (Gen_Avl_Tree_Rk &t) noexcept |
| Join this tree exclusively with another tree. | |
| Node * | split_key (const Key &key, Gen_Avl_Tree_Rk &t1, Gen_Avl_Tree_Rk &t2) noexcept |
| Split tree by key. | |
| void | split_key_dup (const Key &key, Gen_Avl_Tree_Rk &t1, Gen_Avl_Tree_Rk &t2) noexcept |
| Split tree by key including duplicates. | |
| void | split_pos (const size_t pos, Gen_Avl_Tree_Rk &t1, Gen_Avl_Tree_Rk &t2) noexcept |
| Split tree by inorder position. | |
Private Types | |
| enum | Rotation_Type { ROTATE_LEFT , ROTATE_RIGHT , DOUBLE_ROTATE_LEFT , DOUBLE_ROTATE_RIGHT } |
Private Member Functions | |
| bool | avl_stack_at_base () noexcept |
| void | clean_avl_stack () noexcept |
| Node * | search_and_stack_avl (const Key &key, signed char &cmp_result) noexcept |
| Node * | search_dup_and_stack_avl (const Key &key, signed char &cmp_result) noexcept |
| void | restore_avl_after_insertion (Node *p) noexcept |
| Node * | swapWithSuccessor (Node *p, Node *&pp) noexcept |
| void | restore_avl_after_deletion (bool left_deficit) noexcept |
| void | update_counters_after_insertion () noexcept |
| void | update_counters_after_deletion () noexcept |
| Node * | split_key_rec (Node *p, const Key &key, Node *&t1, Node *&t2) noexcept |
| void | split_key_dup_rec (Node *p, const Key &key, Node *&t1, Node *&t2) noexcept |
| void | split_pos_rec (Node *p, size_t pos, Node *&t1, Node *&t2) noexcept |
Static Private Member Functions | |
| static Node * | rotateLeft (Node *p) noexcept |
| static Node * | rotateRight (Node *p) noexcept |
| static Node * | doubleRotateLeft (Node *p) noexcept |
| static Node * | doubleRotateRight (Node *p) noexcept |
| static Rotation_Type | rotation_type (Node *p) noexcept |
| static Node * | restore_avl (Node *p, Node *pp) noexcept |
| static size_t | avl_height (Node *p) noexcept |
| static Node * | extract_min (Node *&p) noexcept |
| static Node * | extract_max (Node *&p) noexcept |
| static Node * | join_exclusive_rec (Node *t1, size_t h1, Node *t2, size_t h2) noexcept |
| static Node * | join_with_pivot (Node *t1, const size_t h1, Node *pivot, Node *t2, const size_t h2) noexcept |
| static Node * | join_right (Node *t1, const size_t h1, Node *pivot, Node *t2, const size_t h2) noexcept |
| static Node * | join_left (Node *t1, const size_t h1, Node *pivot, Node *t2, const size_t h2) noexcept |
Private Attributes | |
| FixedStack< Node * > | avl_stack |
| The type of node. | |
| Node | head_node |
| Node * | head_ptr |
| Node *& | root |
| Compare | cmp |
AVL balanced binary search tree with rank (order statistics).
An AVL tree is a self-balancing binary search tree where the heights of the two child subtrees of any node differ by at most one. This guarantees O(log n) worst-case time complexity for search, insertion, and deletion operations.
The maximum height of an AVL tree with n nodes is bounded by: \( 1.4404 \lg{(n + 2)} - 0.3277 \)
This extended version maintains a count in each node representing the number of nodes in its subtree, enabling O(log n) operations for selecting by position and finding the position of a key.
| NodeType | Template for the node type (typically AvlNodeRk). |
| Key | The type of keys stored in the tree. |
| Compare | Comparison functor for ordering keys. |
Definition at line 112 of file tpl_avlRk.H.
| using Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::key_type = Key |
Definition at line 535 of file tpl_avlRk.H.
| using Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::Node = NodeType<Key> |
Definition at line 115 of file tpl_avlRk.H.
| Enumerator | |
|---|---|
| ROTATE_LEFT | |
| ROTATE_RIGHT | |
| DOUBLE_ROTATE_LEFT | |
| DOUBLE_ROTATE_RIGHT | |
Definition at line 353 of file tpl_avlRk.H.
|
inlinenoexcept |
Definition at line 543 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::head_ptr, and Aleph::FixedStack< T >::push().
|
inlinevirtualnoexcept |
Definition at line 561 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack_at_base(), and Aleph::divide_and_conquer_partition_dp().
|
inlinestaticprivatenoexcept |
Definition at line 767 of file tpl_avlRk.H.
References DIFF, h, LLINK, and RLINK.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_left(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_right(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_rec(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_pos_rec().
|
inlineprivatenoexcept |
Definition at line 124 of file tpl_avlRk.H.
References Aleph::and, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::FixedStack< T >::base(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::head_ptr, Aleph::FixedStack< T >::is_empty(), and Aleph::FixedStack< T >::size().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::~Gen_Avl_Tree_Rk(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_insertion(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_avl().
|
inlineprivatenoexcept |
Definition at line 131 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::FixedStack< T >::base(), Aleph::divide_and_conquer_partition_dp(), Aleph::FixedStack< T >::empty(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::head_ptr, Aleph::FixedStack< T >::is_empty(), Aleph::FixedStack< T >::popn(), Aleph::FixedStack< T >::push(), and Aleph::FixedStack< T >::size().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_deletion(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_insertion(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
inlinestaticprivatenoexcept |
Definition at line 275 of file tpl_avlRk.H.
References Aleph::and, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), LLINK, r, and RLINK.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::extract_min(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_right(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl().
|
inlinestaticprivatenoexcept |
Definition at line 315 of file tpl_avlRk.H.
References Aleph::and, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), LLINK, r, and RLINK.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::extract_max(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_left(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl().
|
inlinestaticprivatenoexcept |
Definition at line 840 of file tpl_avlRk.H.
References Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateRight(), Aleph::FixedStack< T >::is_empty(), LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::rotateRight().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec().
|
inlinestaticprivatenoexcept |
Definition at line 784 of file tpl_avlRk.H.
References Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateLeft(), Aleph::FixedStack< T >::is_empty(), LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::rotateLeft().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec().
|
inlinenoexcept |
Find the inorder position of a key in the tree.
| [in] | key | to be searched |
Definition at line 749 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::find_position(), r, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::find_position().
|
inlineconstexprnoexcept |
Definition at line 541 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::key_comp().
|
inlineconstexprnoexcept |
Return a pointer to the tree's root.
Definition at line 567 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
|
inlineconstexprnoexcept |
Return a modifiable reference to tree's root.
Definition at line 564 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by TEST().
|
inlinenoexcept |
Insert the node pointed by p in the tree.
| [in] | p | the node to be inserted |
Definition at line 588 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::clean_avl_stack(), Aleph::CmpEqual, Aleph::CmpGreater, Aleph::CmpLess, Aleph::divide_and_conquer_partition_dp(), KEY, LLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_insertion(), RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::update_counters_after_insertion().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_exclusive(), TEST(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Insert the node p without testing for key duplicity.
Definition at line 642 of file tpl_avlRk.H.
References Aleph::CmpEqual, Aleph::CmpLess, Aleph::divide_and_conquer_partition_dp(), KEY, LLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_insertion(), RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_avl(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::update_counters_after_insertion().
|
inlineconstexprnoexcept |
|
inlinenoexcept |
Join this tree exclusively with another tree.
All keys in this tree must be less than all keys in t. After the operation, t becomes empty and this tree contains all nodes.
| [in,out] | t | tree to join with (will be empty after) |
Definition at line 1217 of file tpl_avlRk.H.
References Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::FixedStack< T >::is_empty(), LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
|
inlinestaticprivatenoexcept |
Definition at line 894 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_height(), Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::extract_max(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::extract_min(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_with_pivot().
|
inlinestaticprivatenoexcept |
Definition at line 1003 of file tpl_avlRk.H.
References Aleph::and, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_height(), Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateRight(), Aleph::FixedStack< T >::is_empty(), LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::rotateRight().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_with_pivot().
|
inlinestaticprivatenoexcept |
Definition at line 950 of file tpl_avlRk.H.
References Aleph::and, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_height(), Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateLeft(), Aleph::FixedStack< T >::is_empty(), LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::rotateLeft().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_with_pivot().
|
inlinestaticprivatenoexcept |
Definition at line 925 of file tpl_avlRk.H.
References Aleph::and, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_left(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_right(), LLINK, and RLINK.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_exclusive_rec(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_rec(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_pos_rec().
|
inlineconstexprnoexcept |
The key type.
Return a reference to the comparison criteria
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 538 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::get_compare().
|
inlinenoexcept |
Compute the inorder position of a key.
| [in] | key | to be searched |
Definition at line 734 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::divide_and_conquer_partition_dp(), Aleph::inorder_position(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Remove from tree the node containing key.
Returns the removed node if the key is found; nullptr otherwise.
Definition at line 662 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::clean_avl_stack(), Aleph::CmpEqual, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::head_ptr, LLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_deletion(), RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::swapWithSuccessor(), Aleph::FixedStack< T >::top(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::update_counters_after_deletion().
|
inlinestaticprivatenoexcept |
Definition at line 378 of file tpl_avlRk.H.
References AH_ERROR, DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::DOUBLE_ROTATE_LEFT, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::DOUBLE_ROTATE_RIGHT, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateLeft(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::doubleRotateRight(), LLINK, RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::ROTATE_LEFT, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::ROTATE_RIGHT, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::rotateLeft(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::rotateRight(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::rotation_type().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_deletion(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_insertion().
|
inlineprivatenoexcept |
Definition at line 490 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::clean_avl_stack(), DIFF, Aleph::divide_and_conquer_partition_dp(), LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::popn(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, and Aleph::FixedStack< T >::top().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove().
|
inlineprivatenoexcept |
Definition at line 398 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack_at_base(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::clean_avl_stack(), DIFF, Aleph::divide_and_conquer_partition_dp(), LLINK, Aleph::FixedStack< T >::pop(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert_dup(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
inlinestaticprivatenoexcept |
Definition at line 225 of file tpl_avlRk.H.
References Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), LLINK, and RLINK.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::extract_min(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_right(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl().
|
inlinestaticprivatenoexcept |
Definition at line 250 of file tpl_avlRk.H.
References Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), LLINK, and RLINK.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::extract_max(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_left(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl().
|
inlinestaticprivatenoexcept |
Definition at line 358 of file tpl_avlRk.H.
References DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::DOUBLE_ROTATE_LEFT, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::DOUBLE_ROTATE_RIGHT, LLINK, RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::ROTATE_LEFT, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::ROTATE_RIGHT.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl().
|
inlinenoexcept |
Search a node containing key; if found, then a pointer to the node containing it is returned; otherwise nullptr is returned.
Definition at line 577 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::divide_and_conquer_partition_dp(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by TEST().
|
inlineprivatenoexcept |
Definition at line 150 of file tpl_avlRk.H.
References Aleph::and, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack_at_base(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::CmpEqual, Aleph::CmpGreater, Aleph::CmpLess, Aleph::divide_and_conquer_partition_dp(), KEY, LLINK, Aleph::FixedStack< T >::popn(), Aleph::FixedStack< T >::push(), RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, Aleph::FixedStack< T >::size(), and Aleph::FixedStack< T >::top().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
inlineprivatenoexcept |
Definition at line 196 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack_at_base(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::CmpEqual, Aleph::CmpGreater, Aleph::CmpLess, Aleph::divide_and_conquer_partition_dp(), KEY, LLINK, Aleph::FixedStack< T >::push(), RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, and Aleph::FixedStack< T >::top().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert_dup().
|
inlinenoexcept |
Search or insert a key.
| [in] | p | the node whose key must be searched and eventually inserted |
Definition at line 618 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::clean_avl_stack(), Aleph::CmpEqual, Aleph::CmpGreater, Aleph::CmpLess, Aleph::divide_and_conquer_partition_dp(), KEY, LLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_insertion(), RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::update_counters_after_insertion().
Referenced by TEST().
|
inline |
Return the i-th node in order sense.
| [in] | i | inorder position of node to be selected |
| out_of_range | if i is greater or equal than the number of nodes of tree |
Definition at line 723 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, and Aleph::select().
|
inlinenoexcept |
Return the number of nodes in the tree.
Definition at line 570 of file tpl_avlRk.H.
References Aleph::COUNT(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_pos(), TEST(), TEST(), TEST(), TEST(), TEST(), and TEST().
|
inlinenoexcept |
Split tree by key.
After the operation:
| [in] | key | the splitting key |
| [out] | t1 | tree to receive keys < key |
| [out] | t2 | tree to receive keys > key |
Definition at line 1267 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::FixedStack< T >::is_empty(), KEY, LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
|
inlinenoexcept |
Split tree by key including duplicates.
After the operation:
| [in] | key | the splitting key |
| [out] | t1 | tree to receive keys <= key |
| [out] | t2 | tree to receive keys > key |
Definition at line 1317 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::FixedStack< T >::is_empty(), KEY, LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
Referenced by TEST().
|
inlineprivatenoexcept |
Definition at line 1115 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_height(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_with_pivot(), KEY, LLINK, RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec().
|
inlineprivatenoexcept |
Definition at line 1054 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_height(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_with_pivot(), KEY, LLINK, RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_rec().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_rec().
|
inlinenoexcept |
Split tree by inorder position.
After the operation:
| [in] | pos | the splitting position (0-based) |
| [out] | t1 | tree to receive positions [0, pos) |
| [out] | t2 | tree to receive positions [pos, size) |
Definition at line 1361 of file tpl_avlRk.H.
References Aleph::count(), Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::FixedStack< T >::is_empty(), LLINK, Aleph::FixedStack< T >::pop(), Aleph::FixedStack< T >::push(), RLINK, Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::size().
|
inlineprivatenoexcept |
Definition at line 1162 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_height(), Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_with_pivot(), LLINK, RLINK, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_pos_rec().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_pos_rec().
|
inlinenoexcept |
Swap in constant time all the items of this with the items of tree.
| [in] | tree | the tree to swap with this |
Definition at line 555 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::cmp, and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
|
inlineprivatenoexcept |
Definition at line 439 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::COUNT(), DIFF, Aleph::divide_and_conquer_partition_dp(), LLINK, Aleph::FixedStack< T >::push(), RLINK, and Aleph::FixedStack< T >::top().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove().
|
inlineprivatenoexcept |
Definition at line 527 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::COUNT(), Aleph::FixedStack< T >::size(), and Aleph::FixedStack< T >::top().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove().
|
inlineprivatenoexcept |
Definition at line 517 of file tpl_avlRk.H.
References Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack, Aleph::COUNT(), Aleph::FixedStack< T >::size(), and Aleph::FixedStack< T >::top().
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert_dup(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_or_insert().
|
inlinenoexcept |
Return true if the tree is a valid AVL tree with correct counters.
Definition at line 760 of file tpl_avlRk.H.
References Aleph::and, Aleph::check_rank_tree(), Aleph::is_avl_rk(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::root.
|
private |
The type of node.
Definition at line 118 of file tpl_avlRk.H.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::Gen_Avl_Tree_Rk(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack_at_base(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::clean_avl_stack(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_deletion(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_insertion(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::swapWithSuccessor(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::update_counters_after_deletion(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::update_counters_after_insertion().
|
private |
Definition at line 122 of file tpl_avlRk.H.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::find_position(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::key_comp(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::position(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_dup(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_dup_rec(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_rec(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::swap().
|
private |
Definition at line 119 of file tpl_avlRk.H.
|
private |
Definition at line 120 of file tpl_avlRk.H.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::Gen_Avl_Tree_Rk(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::avl_stack_at_base(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::clean_avl_stack(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove().
|
private |
Definition at line 121 of file tpl_avlRk.H.
Referenced by Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::find_position(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::getRoot(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::getRoot(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::insert_dup(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::is_empty(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::join_exclusive(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::position(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::remove(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::restore_avl_after_deletion(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_dup_and_stack_avl(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::search_or_insert(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::select(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::size(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_key_dup(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::split_pos(), Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::swap(), and Aleph::Gen_Avl_Tree_Rk< NodeType, Key, Compare >::verify().