41#include <gtest/gtest.h>
46using namespace testing;
55 std::vector<Node *> allocated;
57 Node *
make(
const typename Node::Key_Type & key)
60 allocated.push_back(p);
66 for (
Node * p : allocated)
74 std::vector<typename Node::Key_Type> keys;
85 const std::vector<int>
input{5, 3, 7, 2, 4, 6, 8};
108 for (
int k : {3, 1, 4, 2})
127 auto * a = pool.make(5);
128 auto * b = pool.make(5);
139 EXPECT_EQ(keys, (std::vector<int>{5, 5}));
146 for (
int k : {1, 2, 3, 4, 5})
167 for (
int k : {1, 2, 3, 4, 5})
182 for (
int k : {1, 2, 3, 4, 5})
202 for (
int k : {1, 3, 5})
204 for (
int k : {2, 3, 4})
239 for (
int k : {1, 2, 3})
251 auto * p = pool.make(2);
256 auto *
other = pool.make(2);
287 for (
int k : {1, 2, 3})
289 for (
int k : {4, 5, 6})
WeightedDigraph::Node Node
Node for binary search tree.
void empty() noexcept
empty the list
void join_dup(GenBinTree &t) noexcept
Join this with t independently of the presence of duplicated keys.
Node *& getRoot() noexcept
Return the root of tree.
bool split(const Key &key, GenBinTree &l, GenBinTree &r) noexcept
Split the tree according to a key.
bool verify() const
Return true if the tree is a consistent (correct) binary search tree.
Node * insert(Node *p) noexcept
Insert a node in the tree.
void split_dup(const Key &key, GenBinTree &l, GenBinTree &r) noexcept
Split the tree according to a key that could be in the tree.
Node * search(const Key &key) const noexcept
Search a key.
void join(GenBinTree &tree, GenBinTree &dup) noexcept
Join tree with this.
Node * remove(const Key &key) noexcept
Remove a key from the tree.
void join_exclusive(GenBinTree &t) noexcept
Join exclusive of this with t
void swap(GenBinTree &tree) noexcept
Swap this with tree in constant time.
Node * search_or_insert(Node *p) noexcept
Search or insert a key.
iterator end() noexcept
Return an STL-compatible end iterator.
iterator begin() noexcept
Return an STL-compatible iterator to the first element.
__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)
constexpr Node *& RLINK(Node *p) noexcept
Return the right tree of p.
constexpr Node *& LLINK(Node *p) noexcept
Return a pointer to left subtree.
Main namespace for Aleph-w library functions.
DynList< T > maps(const C &c, Op op)
Classic map operation.
std::vector< int > inorder_keys(NodeT *root)
Binary search tree with nodes without virtual destructors,.
Generic unbalanced binary search tree.