6#include <gtest/gtest.h>
33 child = child->get_right_sibling())
49 child = child->get_right_sibling())
68 while (child !=
nullptr)
136 const unsigned seed = 12345;
192 for (
int i = 0; i < 10; ++i)
196 EXPECT_EQ(count_nodes(tree),
static_cast<size_t>(10 + i * 5));
335 std::vector<size_t>
sizes = {10, 50, 100, 500, 1000};
337 for (
size_t n :
sizes)
Tree_Node * get_left_child() const noexcept
Returns the leftmost child of this.
Tree_Node * get_right_sibling() const noexcept
Returns the right sibling of this.
Generator for uniformly random trees.
void destroy_tree(Tree_Node< T > *root)
size_t count_nodes(Tree_Node< T > *root)
size_t tree_height(Tree_Node< T > *root)
__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)
void destroy_tree(Node *root)
Destroys (frees memory) the tree whose root is root.
Main namespace for Aleph-w library functions.
void next()
Advance all underlying iterators (bounds-checked).
DynList< T > maps(const C &c, Op op)
Classic map operation.
Itor::difference_type count(const Itor &beg, const Itor &end, const T &value)
Count elements equal to a value.
Random tree generation using GSL random number generator.
TEST_F(RandomTreeTest, GenerateSingleNode)
Utility functions for binary tree operations.
General tree (n-ary tree) node.