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};
91 auto * found = t.
search(4);
108 for (
int k : {3, 1, 4, 2})
127 auto * a = pool.make(5);
128 auto * b = pool.make(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 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.
__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)
Main namespace for Aleph-w library functions.
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.
std::vector< int > inorder_keys(NodeT *root)
Binary search tree with nodes without virtual destructors,.
Generic unbalanced binary search tree.