106 template <
template <
typename>
class NodeType,
typename Key,
class Compare>
173 while (p != Node::NullPtr);
215 while (p != Node::NullPtr);
281 else if (
DIFF(
r) == -1)
318 else if (
DIFF(
r) == -1)
433 while (
LLINK(succ) != Node::NullPtr)
450 LLINK(p) = Node::NullPtr;
451 if (
RLINK(p) == succ)
519 std::swap(
root, tree.root);
520 std::swap(
cmp, tree.cmp);
536 while (p != Node::NullPtr)
542 else if (
cmp(
KEY(p), key))
563 if (
root == Node::NullPtr)
600 if (
root == Node::NullPtr)
623 if (
root == Node::NullPtr)
642 if (
root == Node::NullPtr)
658 if (
LLINK(p) == Node::NullPtr)
667 if (
RLINK(p) == Node::NullPtr)
734 template <
typename Key,
class Compare = Aleph::less<Key>>
757 template <
typename Key,
class Compare = Aleph::less<Key>>
C++20 concepts for constraining comparison functors.
#define AH_ERROR(format, args...)
Print an error message (always enabled).
Standard functor implementations and comparison objects.
AVL tree node with balance factor.
bool is_avl(Node *p)
Validate that a tree satisfies AVL properties.
#define DIFF(p)
Access the balance factor of node p.
Inorder iterator on the nodes of a binary tree.
T & base() noexcept
Return the internal array base.
size_t size() const noexcept
Return the number of elements stored in the stack.
T popn(const int &n) noexcept
Perform in constant time n pops.
bool is_empty() const noexcept
Return true if stack is empty.
T pop() noexcept
Pop by moving the top of stack.
T & top() noexcept
Return a modifiable reference to stack's top.
void empty() noexcept
Empty the stack.
T & push(const T &data) noexcept(std::is_nothrow_copy_assignable_v< T >)
Push a copy of data
AVL balanced binary search tree.
Node * search(const Key &key) const noexcept
Search a node containing key; if found, then a pointer to the node containing it is returned; otherwi...
static Node * restore_avl(Node *p, Node *pp) noexcept
void restore_avl_after_insertion(Node *p) noexcept
void swap(Gen_Avl_Tree &tree) noexcept
Swap in constant time all the items of this with the items of tree.
Node * search_or_insert(Node *p) noexcept
Search or insert a key.
constexpr Compare & get_compare() noexcept
Node * insert_dup(Node *p) noexcept
Insert the node p without testing for key duplicity.
constexpr Node *& getRoot() noexcept
Return a modifiable reference to tree's root.
virtual ~Gen_Avl_Tree() noexcept
Node * search_and_stack_avl(const Key &key, signed char &cmp_result) noexcept
static Node * doubleRotateLeft(Node *p) noexcept
Node * insert(Node *p) noexcept
Insert the node pointed by p in the tree.
Node * swapWithSuccessor(Node *p, Node *&pp) noexcept
Gen_Avl_Tree(Compare _cmp=Compare()) noexcept
void clean_avl_stack() noexcept
bool verify() const noexcept
Node * search_dup_and_stack_avl(const Key &key, signed char &cmp_result) noexcept
static Rotation_Type rotation_type(Node *p) noexcept
Node * remove(const Key &key) noexcept
Remove from an AVL tree the node containing key key.
constexpr Node * getRoot() const noexcept
Return a modifiable reference to tree's root.
constexpr Compare & key_comp() noexcept
The key type.
static Node * doubleRotateRight(Node *p) noexcept
bool avl_stack_at_base() noexcept
void restore_avl_after_deletion(bool left_deficit) noexcept
static Node * rotateRight(Node *p) noexcept
static Node * rotateLeft(Node *p) noexcept
FixedStack< Node * > avl_stack
The type of node.
Strict weak ordering constraint for BST comparators.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
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.
@ CmpGreater
First argument is greater than second.
@ CmpLess
First argument is less than second.
@ CmpEqual
Arguments are equal.
AVL binary search tree with virtual destructor in its nodes.
AVL binary search tree with nodes without virtual destructor.
Iterator() noexcept=default
Default constructor creates an "end" iterator.
Iterator(const Gen_Avl_Tree &tree)
Stack implementations backed by dynamic or fixed arrays.
Utility functions for binary tree operations.