80 if (p == Node::NullPtr)
97 LLINK(p) = luka_to_tree<Node>(cod);
98 RLINK(p) = luka_to_tree<Node>(cod);
103int main(
int argc,
char *argv[])
105 const size_t n = argc > 1 ? atol(argv[1]) : 10;
107 int t = std::time(NULL);
112 cout <<
"testLuka " << n <<
" " << t << endl;
116 BinNode<int> * tree_root = random_tree< BinNode<int> >(n);
118 string s =
luka(tree_root);
119 cout <<
"luka(tree_root) = " << s << endl;
121 char * cod_orig = strdup(s.c_str());
122 char * cod = cod_orig;
Exception handling system with formatted messages for Aleph-w.
The random number generators of Aleph: the one that gives the numbers of the gsl_rng_mt19937 of GSL,...
WeightedDigraph::Node Node
Node for binary search tree.
A random number generator with the sequences of GSL's gsl_rng_mt19937.
static constexpr result_type max() noexcept
The greatest number of operator()(): 2^32 - 1.
void seed(const unsigned long s) noexcept
Seeds again, as gsl_rng_set(r, s).
unsigned long uniform_int(const unsigned long n)
An integer in [0, n), each with the same probability, as gsl_rng_uniform_int(r, n).
__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 destroyRec(Node *&root) noexcept
Free all the memory occupied by the tree root
bool areSimilar(Node *t1, Node *t2) noexcept
Return true if both trees are similar.
void init_random(int seed)
size_t get_rand(const size_t &n)
Node * random_tree(const size_t &n)
Node * luka_to_tree(char *&cod)
Utility functions for binary tree operations.
Basic binary tree node definitions.