45# ifndef TPL_DYNSETTREE_H
46# define TPL_DYNSETTREE_H
51# include <type_traits>
83 template <
typename Node>
98 template <
typename Node>
104 return new Node(key);
109 return new Node(std::forward<typename Node::key_type>(key));
135 template <
typename Node>
149 :
arena(base_addr, sz)
163 return build(std::forward<typename Node::key_type>(key));
243 void * room =
take();
247 return ::new (room)
Node(std::forward<K>(key));
257 template <
typename Container,
typename T>
262 return std::lexicographical_compare(c1.begin(), c1.end(), c2.begin(), c2.end(),
263 [](
const T & item1,
const T & item2)
265 return item1 < item2;
353 template <
typename Key,
356 requires StrictWeakOrder<Compare, Key> &&
357 BSTPolicy<Tree<Key, Compare>, Key>
361 public GenericKeys<DynSetTree<Key, Tree, Compare>, Key>,
373 template <
typename T>
379 requires(
const T & t) { t.select(std::declval<size_t>()); } or
380 requires(
T & t) { t.select(std::declval<size_t>()); };
382 requires(
T & t) { t.remove_pos(std::declval<size_t>()); };
384 requires(
T & t,
T &
l,
T &
r) { t.split_pos(std::declval<size_t>(),
l,
r); };
386 requires(
const T & t,
const Key &
k) { t.position(
k); } or
387 requires(
T & t,
const Key &
k) { t.position(
k); };
389 requires(
const T & t,
const Key &
k) { t.find_position(
k); } or
390 requires(
T & t,
const Key &
k) { t.find_position(
k); };
394 template <
typename T>
396 ->
decltype(t.select(i))
402 template <
typename T>
404 ->
decltype(t.select(i))
409 template <
typename T>
416 template <
typename T>
423 template <
typename T>
425 ->
decltype(t.remove_pos(i))
427 return t.remove_pos(i);
430 template <
typename T>
437 template <
typename T>
439 ->
decltype(t.split_pos(pos,
l,
r), void())
441 t.split_pos(pos,
l,
r);
444 template <
typename T>
450 template <
typename T>
452 ->
decltype(t.position(key))
454 return t.position(key);
457 template <
typename T>
461 return std::pair<long, Node *>(0,
nullptr);
464 template <
typename T>
466 ->
decltype(t.find_position(key))
468 return t.find_position(key);
471 template <
typename T>
474 ah_domain_error() <<
"find_position is not supported by underlying tree";
475 return std::pair<long, Node *>(0,
nullptr);
478 static constexpr size_t dim = 13;
488 return new Node(key);
495 return new Node(std::forward<Key>(key));
528 } release_p{
this, p};
546 noexcept(
noexcept(
tree.swap(dset.tree))
and
550 tree.swap(dset.tree);
564 std::is_nothrow_default_constructible_v<Compare>
and
565 std::is_nothrow_constructible_v<Tree<Key, Compare>, Compare>;
598 noexcept(std::is_nothrow_constructible_v<Tree<Key, Compare>,
607 const Compare &
cmp = Compare())
616 const Compare &
cmp = Compare())
627 Node *srcRoot = srcTree.
tree.getRoot();
673 noexcept(std::is_nothrow_move_constructible_v<Tree<Key, Compare>>)
675 :
tree(std::move(srcTree.tree)),
num_nodes(srcTree.num_nodes),
679 assert(srcTree.tree.getRoot() == Node::NullPtr);
680 srcTree.num_nodes = 0;
701 requires std::is_copy_constructible_v<Tree<Key, Compare>>
732 tree.getRoot() = Node::NullPtr;
738 tree.getRoot() = Node::NullPtr;
769 if (
this == &srcTree)
787 noexcept(
noexcept(
swap(srcTree)))
789 if (
this == &srcTree)
809 q =
tree.search_or_insert(p);
822 return &p->get_key();
838 if (key_p ==
nullptr)
851 if (key_p ==
nullptr)
867 return insert(std::forward<Key>(key));
876 q =
tree.search_or_insert(p);
889 return &q->get_key();
897 q =
tree.search_or_insert(p);
907 return std::pair<Node *, bool>(q,
true);
910 return std::pair<Node *, bool>(p,
false);
953 return std::pair<Key *, bool>(&p.first->get_key(), p.second);
959 return std::pair<Key *, bool>(&p.first->get_key(), p.second);
969 return &p->get_key();
989 Key *
put(
const Key & key)
996 return insert(std::forward<Key>(key));
1035 <<
"DynSetTree::del key is not found in the tree";
1052 <<
"remove_pos is not supported by underlying tree";
1055 <<
"remove_pos index out of range";
1059 <<
"remove_pos returned nullptr";
1067 return search(key) !=
nullptr;
1070 bool has(
const Key & key)
const
1105 return node->get_key();
1110 const Key &
find(
const Key & key)
const
1115 return node->get_key();
1135 <<
"find_position is not supported by underlying tree";
1138 return std::pair<long, Key *>(0,
nullptr);
1141 if (p.second ==
nullptr)
1142 return std::pair<long, Key *>(
static_cast<long>(p.first),
nullptr);
1144 return std::pair<long, Key *>(
static_cast<long>(p.first),
1145 &p.second->get_key());
1165 if (node ==
nullptr)
1167 return &(node->get_key());
1175 if (node ==
nullptr)
1177 return &(node->get_key());
1283 <<
"position is not supported by underlying tree";
1286 return static_cast<long>(p.first);
1297 <<
"select is not supported by underlying tree";
1300 <<
"select index out of range";
1305 <<
"select returned nullptr";
1306 return p->get_key();
1312 <<
"select is not supported by underlying tree";
1315 <<
"select index out of range";
1320 <<
"select returned nullptr";
1321 return p->get_key();
1350 template <
class Key_Op>
1366 assert(
root !=
nullptr);
1396 template <
class Key_Op>
1413 template <
class Key_Op>
1416 for_each_preorder<Key_Op>(key_op);
1443 template <
class Key_Op>
1460 template <
class Key_Op>
1463 for_each_inorder<Key_Op>(key_op);
1490 template <
class Key_Op>
1507 template <
class Key_Op>
1510 for_each_postorder<Key_Op>(key_op);
1532 const size_t dup_before = dup.
num_nodes;
1534 t.
tree.getRoot() = Node::NullPtr;
1554 return join(t, dup);
1574 t.
tree.getRoot() = Node::NullPtr;
1596 if (not
tree.split_key(key,
l.tree,
r.tree))
1600 tree.getRoot() = Node::NullPtr;
1623 <<
"split_pos is not supported by underlying tree";
1626 <<
"split_pos position out of range";
1633 tree.getRoot() = Node::NullPtr;
1654 tree.split_key_dup(key,
l.tree,
r.tree);
1655 tree.getRoot() = Node::NullPtr;
1663 using Base =
typename Tree_Type::Iterator;
1680 return Base::get_curr_ne()->get_key();
1683 Key &
get_curr_ne() noexcept {
return Base::get_curr_ne()->get_key(); }
1685 const Key &
get_curr()
const {
return Base::get_curr()->get_key(); }
1687 Key &
get_curr() {
return Base::get_curr()->get_key(); }
1710 template <
class Operation>
1716 return op(p->get_key());
1721 template <
class Operation>
1725 return traverse<Operation>(op);
1735 template <
class Operation>
1741 return op(static_cast<const Key &>(p->get_key()));
1746 template <
class Operation>
1750 return traverse<Operation>(op);
1759 return tree.get_compare();
1777 noexcept(
noexcept(
tree.get_compare()))
1779 return tree.get_compare();
1784# define SETTREE_ITOR(Name, Key, Cmp) \
1785 class Iterator : public DynSetTree<Key, Name, Cmp>::Iterator \
1788 Iterator() : DynSetTree<Key, Name, Cmp>::Iterator() \
1791 Iterator(DynSetTree<Key, Name, Cmp> & tree) \
1792 : DynSetTree<Key, Name, Cmp>::Iterator(tree) \
1803 template <
typename Key,
class Compare = Aleph::less<Key>>
1819 template <
typename Key,
class Compare = Aleph::less<Key>>
1835 template <
typename Key,
class Compare = Aleph::less<Key>>
1858 template <
typename Key,
class Compare = Aleph::less<Key>>
1875 template <
typename Key,
class Compare = Aleph::less<Key>>
1904 template <
typename Key,
class Compare = Aleph::less<Key>>
1919 template <
typename Key,
class Compare = Aleph::less<Key>>
1938 template <
typename Key,
class Compare = Aleph::less<Key>>
1955 template <
typename Key,
class Compare = Aleph::less<Key>>
1975 template <
typename Key,
class Compare = Aleph::less<Key>>
1993 template <
typename Key,
class Compare = Aleph::less<Key>>
2013 template <
typename Key,
class Compare = Aleph::less<Key>>
2037 template <
typename Key,
class Compare = Aleph::less<Key>>
2061 template <
typename Key,
class Compare = Aleph::less<Key>>
2072 template <
typename T,
class Op,
class C>
2076 for (
auto it = c.get_it(); it.has_curr(); it.next_ne())
2077 ret.
insert(op(it.get_curr()));
Memory arena for fast bulk allocations.
Variadic constructor macros for containers.
C++20 concepts hub: comparison, BST policy, and Aleph container concepts.
#define Derived_Build(Name)
Declare build() in a class derived from a container.
Exception handling system with formatted messages for Aleph-w.
#define ah_domain_error()
Throws std::domain_error unconditionally.
#define ah_domain_error_if_constexpr(C)
#define ah_out_of_range_error_if(C)
Throws std::out_of_range if condition holds.
#define ah_domain_error_if(C)
Throws std::domain_error if condition holds.
#define ah_logic_error_if(C)
Throws std::logic_error if condition holds.
#define ah_bad_alloc_if(C)
Throws std::bad_alloc if condition holds.
Zip iterators and functional operations for multiple containers.
#define Special_Ctors(Set_Type, Type)
Generates special constructors for containers.
Iterator traits and STL-compatible iterator wrappers.
WeightedDigraph::Node Node
virtual void unalloc(Node *)=0
virtual Node * alloc_rval(typename Node::key_type &&key)=0
virtual Node * alloc_lval(const typename Node::key_type &key)=0
AbstractTreeNodeAllocator()=default
virtual ~AbstractTreeNodeAllocator()=default
Arena allocator for fast bump-pointer allocation.
bool contains(const void *ptr) const noexcept
Check if a pointer is within this arena's range.
void * alloc_aligned(const size_t size, const size_t alignment) noexcept
Allocate aligned memory from the arena.
void reset() noexcept
Reset arena, making all memory available again.
void dealloc(const void *addr, const size_t size) noexcept
Deallocate memory (only effective for LIFO pattern).
size_t allocated_size() const noexcept
Get total bytes currently allocated.
size_t available_size() const noexcept
Get remaining bytes available.
Read-only view of an Aleph iterator: the iterator of a constant container.
~DftTreeNodeAllocator() override=default
Node * alloc_lval(const typename Node::key_type &key) override
Node * alloc_rval(typename Node::key_type &&key) override
void unalloc(Node *p) override
Doubly-linked list (defined in tpl_dynList.H).
Dynamic set implemented using extended AVL binary search trees with rank support of type Avl_Tree_Rk<...
Dynamic set implemented using AVL binary search trees of type Avl_Tree<Key>.
Dynamic set implemented using binary search trees of type BinTree<Key>.
Dynamic set implemented using Hybrid Red-Black trees with rank support of type HtdRbTreeRk<Key>.
Dynamic set implemented using Hybrid Top-Down/Bottom-Up Red-Black trees of type HtdRbTree<Key>.
Iterator(DynSetTree< Key, Rand_Tree, Compare > &tree)
Dynamic set implemented using randomized binary search trees of type Rand_Tree<Key>.
Dynamic set implemented using extended Red-Black binary search trees with rank support of type Rb_Tre...
Dynamic set implemented using Red-Black binary search trees of type Rb_Tree<Key> (bottom-up implement...
Dynamic set implemented using splay trees with rank support of type Splay_Tree_Rk<Key>.
Dynamic set implemented using splay binary search trees of type Splay_Tree<Key>.
Dynamic set implemented using Top-Down Red-Black binary search trees with rank support of type TdRbTr...
Dynamic set implemented using Top-Down Red-Black binary search trees of type TdRbTree<Key>.
Dynamic set implemented using extended treap binary search trees with rank support of type Treap_Rk<K...
Dynamic set implemented using randomized treap binary search trees of type Treap<Key>.
Dynamic set backed by balanced binary search trees with automatic memory management.
const Key & get_first() const
See min.
DynSetTree(const Compare &cmp) noexcept(std::is_nothrow_constructible_v< Tree< Key, Compare >, const Compare & >)
Builds an empty set with the comparison criteria cmp.
size_t height() const
Calculates and returns the height of the binary search tree.
virtual ~DynSetTree()
Destroyer; all elements are released.
const Key & min() const
Returns the smallest key contained in the set according to the criterion comparison given.
long position(const Key &key) const
Returns the infix (ordered) position of the key.
DynSetTree() noexcept(nothrow_empty_tree)
Builds an empty set, with a comparison criteria built by default.
Key * append(const Key &key)
Key & find(const Key &key)
Returns a modifiable reference to an element within the set.
const Key & get_last() const
See max.
Key * __insert_dup(Node *q)
bool split_key(const Key &key, DynSetTree &l, DynSetTree &r)
Partitions the binary search tree based on a key.
typename Tree< Key, Compare >::Node Node
Type of binary node used by the binary search tree internal.
std::pair< Key *, bool > contains_or_insert(Key &&key)
const Key & get_item() const
Returns any element of the set.
DynSetTree & join(DynSetTree &t, DynSetTree &&dup=DynSetTree())
This is an overloaded member function, provided for convenience. It differs from the above function o...
Key & operator()(size_t i)
const size_t & size() const
Returns the cardinality of the set.
Key remove_pos(const size_t i)
Removes the key at the inorder position i.
static auto call_select(const T &t, const size_t i, int) -> decltype(t.select(i))
Node * alloc_node(const Key &key)
static auto call_find_position(const T &t, const Key &key, int) -> decltype(t.find_position(key))
static auto call_split_pos(T &t, const size_t pos, T &l, T &r, int) -> decltype(t.split_pos(pos, l, r), void())
static constexpr size_t dim
Key del(const Key &key)
Deletes key and returns a full copy of stored key.
void clear()
Empties the container.
std::pair< long, Key * > find_position(const Key &key) const
Returns the infix (ordinate) position of the key key or whatever It would be your position of belongi...
const Key * search(const Key &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
DynSetTree(const DynSetTree &srcTree)
instantiates a dynamic copy of srcTree
Tree< Key, Compare > tree
const Key & operator[](const Key &key) const
Key * insert(const Key &key)
Inserts a key into the dynamic set.
const Key & max() const
Returns the largest key contained in the set according to the criteria comparison given.
bool exist(const Key &key) const
Returns true if key belongs to the dynamic set.
void split_key_dup(const Key &key, DynSetTree &l, DynSetTree &r)
Partitions the binary search tree based on a key that may be present in the tree.
bool has(const Key &key) const
void swap(DynSetTree &dset) noexcept(noexcept(tree.swap(dset.tree)) and noexcept(std::swap(num_nodes, dset.num_nodes)) and noexcept(std::swap(arena_allocator, dset.arena_allocator)))
Exchange all elements of this set with dset in constant time (and extremely fast).
void for_each_postorder(Key_Op &key_op) const
Performs a postfix traversal over all keys in the set and invokes operation Op.
Key * put(const Key &key)
const Key & find(const Key &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static std::pair< long, Node * > call_position(const T &, const Key &,...)
size_t internal_path_length() const
Calculates and returns the length of the internal path of the tree search binary.
static constexpr bool nothrow_empty_tree
Whether building an empty tree with a comparison built by default throws nothing.
size_t remove(const Key &key)
Removes a key from the dynamic set.
std::unique_ptr< ArenaTreeAllocator< Node > > arena_allocator
bool contains(const Key &key) const
Checks if a key exists in the set.
const Key & get() const
Synonym of max.
const Key & get_root() const
DynSetTree(const size_t &arena_sz, const Compare &cmp=Compare())
Instantiate a dynamic set using an arena allocator with dynamic buffer.
Key * search_or_insert(Key &&key)
DynSetTree(DynSetTree &&srcTree) noexcept(nothrow_empty_tree and noexcept(swap(srcTree)))
Take the elements of another set, which is left empty: on a tree that can be copied,...
Node * alloc_node(Key &&key)
bool traverse(Operation &op) const
Traverse a constant set in order; each key is handed out as a constant reference.
Key * search(const Key &key)
Find an element in the set.
Key * insert_dup(const Key &key)
void for_each_preorder(Key_Op &&key_op=Key_Op()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void split_pos(const size_t pos, DynSetTree &l, DynSetTree &r)
Partitions the binary search tree based on an infix position.
bool traverse(Operation &&op=Operation())
See traverse(Operation & op).
void for_each_postorder(Key_Op &&key_op=Key_Op()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void for_each_in_preorder(void(*visitFct)(Node *, int, int))
Performs a prefix traversal over all nodes in the tree and invokes the visitFct operation on each vis...
DynSetTree(const char *base_addr, const size_t &sz, const Compare &cmp=Compare())
Instantiate a dynamic set using an arena allocator with external buffer.
static Node * call_select_nc(T &, const size_t,...)
static auto call_position(const T &t, const Key &key, int) -> decltype(t.position(key))
size_t arena_allocated_size() const noexcept
Returns the allocated size from the arena (0 if not using arena)
DynSetTree(DynSetTree &&srcTree) noexcept(std::is_nothrow_move_constructible_v< Tree< Key, Compare > >)
Take the elements of another set, which is left empty: on a tree that cannot be copied,...
Key & select(size_t i)
Returns the ith node in infix position.
Key * __search_or_insert(Node *p)
decltype(auto) get_compare() const noexcept(noexcept(tree.get_compare()))
The comparator that orders the keys, as the tree gives it.
static auto call_select_nc(T &t, const size_t i, int) -> decltype(t.select(i))
std::pair< Node *, bool > __contains_or_insert(Node *p)
void empty()
Remove all the elements of the set.
bool uses_arena() const noexcept
Returns true if the set is using an arena allocator.
static auto call_remove_pos(T &t, const size_t i, int) -> decltype(t.remove_pos(i))
static Node * call_select(const T &, const size_t,...)
void for_each_inorder(Key_Op &&key_op=Key_Op()) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
const Key & select(size_t i) const
DynSetTree & operator=(const DynList< Key > &list)
bool traverse(Operation &op)
Traverse all the set of pairs and for each key executes the operation op.
Compare key_comp() const
Return a copy of the comparator that orders the keys.
Key * search_or_insert(const Key &key)
Look for the key in the binary search tree or inserts it if it is not found.
static void call_split_pos(T &, const size_t, T &, T &,...)
void for_each_preorder(Key_Op &key_op) const
Performs a prefix traversal over all keys in the set and invokes operation Op.
static Node * call_remove_pos(T &, const size_t,...)
void pin_arena() noexcept
Pin the arena, if any: nodes of this set are going to another one.
void for_each_inorder(Key_Op &key_op) const
Performs an infix traversal over all keys in the set and invokes operation Op.
bool traverse(Operation &&op=Operation()) const
See traverse(Operation & op) const.
std::pair< Key *, bool > contains_or_insert(const Key &key)
bool is_empty() const
returns true if the set is empty
static std::pair< long, Node * > call_find_position(const T &, const Key &,...)
Key * insert_dup(Key &&key)
Node * get_root_node() const
size_t arena_available_size() const noexcept
Returns the available size in the arena (0 if not using arena)
Generic inorder traversal of a binary tree.
Generic postorder traversal of a binary tree.
Generic preorder traversal of a binary tree.
Hybrid top-down/bottom-up red-black tree with rank support.
Hybrid top-down/bottom-up red-black tree.
Top-down red-black tree with rank (no virtual destructor).
Equality test for containers sorted by a comparator.
Common methods to the Aleph-w ( ) containers.
and
Insert a new element into the container by constructing it from the given args.
Common sequential searching methods on containers.
Node for QuadTree spatial data structure.
QuadTree - Hierarchical spatial index for 2D points.
Mixin that adds STL begin()/end() and cbegin()/cend() to Aleph containers.
f(args...) is a valid call whose result is usable as a condition.
__gmp_expr< T, __gmp_binary_expr< __gmp_expr< T, U >, unsigned long int, __gmp_root_function > > root(const __gmp_expr< T, U > &expr, unsigned long int l)
int cmp(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
DynSetTree & join(DynSetTree &t, DynSetTree &dup)
Union of two binary search trees.
int preOrderRec(Node *root, void(*visitFct)(Node *, int, int))
Traverse recursively in preorder a binary tree.
Node * find_min(Node *root) noexcept
Return the minimum key contained in a binary search tree.
bool traverse(Node *root, Op op)
See infix_traverse().
Node * copyRec(Node *root)
Copy a tree.
bool check_bst(Node *p, const Compare &cmp=Compare())
Return true if p is a binary search tree.
DynSetTree & join_dup(DynSetTree &t)
Union of two binary search trees.
size_t internal_path_length(Node *p) noexcept
Compute the internal path length.
void dispose_tree_nodes(Node *root, Dispose &dispose, const size_t levels=Bin_Tree_Depth_Bound) noexcept
Dispose of every node of a tree in postorder.
void destroyRec(Node *&root) noexcept
Free all the memory occupied by the tree root
size_t compute_cardinality_rec(Node *root) noexcept
Count the number of nodes of a binary tree.
size_t computeHeightRec(Node *root) noexcept
Compute the height of root
Node * find_max(Node *root) noexcept
Return the maximum key contained in a binary search tree.
Main namespace for Aleph-w library functions.
Itor2 copy(Itor1 sourceBeg, const Itor1 &sourceEnd, Itor2 destBeg)
Copy elements from one range to another.
DynSetTree< T > set_unify(const C &c, Op op)
std::decay_t< typename HeadC::Item_Type > T
and
Check uniqueness with explicit hash + equality functors.
void callKeyDestructorsRec(Node *&root) noexcept
Traverses the tree and calls key's destructors.
The room of a released node, in the list of those to give again.
Free_Slot * next
The following free room.
Allocator of the nodes of a tree in an arena.
Node * alloc_rval(typename Node::key_type &&key) override
Build a node with key moved into it; throw bad_alloc if it does not fit.
Free_Slot * free_slots
The released rooms.
void reset() noexcept
Make the whole arena available again.
ArenaTreeAllocator(const size_t &sz=1024 *1024)
Build an arena of sz bytes.
size_t available_size() const noexcept
Return the bytes of the arena that were never taken.
void * take() noexcept
Return the room of a node, or nullptr if the arena has none left.
bool pinned
Whether some node was given to another set.
ArenaTreeAllocator(const char *base_addr, const size_t &sz)
Build an arena on the sz bytes at base_addr, owned by the caller.
size_t allocated_size() const noexcept
Return the bytes taken from the arena, released nodes included.
Node * alloc_lval(const typename Node::key_type &key) override
Build a node with a copy of key; throw bad_alloc if it does not fit.
void pin() noexcept
Note that some node of this arena is now in another set.
void give_back(void *p) noexcept
Release a room: the arena takes back its last block, the list any other.
AhArenaAllocator arena
The memory of the nodes.
~ArenaTreeAllocator()=default
bool is_pinned() const noexcept
Return true if some node of this arena was given to another set.
void unalloc(Node *p) override
Destroy the node p and keep its room, if it is of this arena.
Node * build(K &&key)
Build a node of key in a free room; throw bad_alloc if there is none.
Ranked AVL tree with nodes without a virtual destructor.
AVL binary search tree with nodes without a virtual destructor.
bool operator()(const Container &c1, const Container &c2) const
static constexpr bool has_select
static constexpr bool has_split_pos
static constexpr bool has_find_position
static constexpr bool has_remove_pos
static constexpr bool has_position
Iterator(const DynSetTree &)=delete
A constant set is iterated through Const_Iterator.
const Key & get_curr_ne() const noexcept
typename Tree_Type::Iterator Base
Iterator() noexcept=default
Default constructor creates an "end" iterator.
const Key & get_curr() const
Key & get_curr_ne() noexcept
Node_Op(Key_Op &&__key_op)
Node_Op(Key_Op &__key_op)
void operator()(Node *root)
Randomized binary search tree.
Red-Black binary search tree with nodes without virtual destructor and with subtree counters for sele...
Extended treap (a special type of randomized binary search tree) which manages selection and splittin...
Generic list of items stored in a container.
AVL tree with rank (order statistics).
AVL tree implementation (height-balanced BST).
Utility functions for binary tree operations.
Extended binary node with subtree count.
Generic unbalanced binary search tree.
#define SETTREE_ITOR(Name, Key, Cmp)
Hybrid top-down/bottom-up red-black tree with rank support.
Hybrid top-down/bottom-up red-black tree implementation.
Randomized binary search tree.
Red-Black tree with rank (order statistics).
Red-Black tree implementation (bottom-up balancing).
Top-down splay tree with rank support.
Top-down splay tree implementation (without rank support).
Top-down Red-Black tree with rank support.
Top-down Red-Black tree implementation.
Treap with rank (order statistics).
Treap: randomized BST combining tree and heap properties.