50 uniform_int_distribution<int> dist(
l,
r);
72 cout <<
" " << node->get_key();
76int main(
int argc,
char *argv[])
81 try { n = stoi(argv[1]); }
82 catch (...) { n = 2; }
87 cerr <<
"Error: n must be a positive integer." << endl;
91 unsigned int t = std::time(0);
95 try { t =
static_cast<unsigned int>(stoul(argv[2])); }
96 catch (...) { t = std::time(0); }
101 cout << argv[0] <<
" " << n <<
" " << t << endl;
104 unique_ptr<BinNode<int>,
decltype(bp_deleter)> bp_ptr(
random_tree(1, n), bp_deleter);
109 cout << endl << endl;
113 cout << endl << endl;
116 unique_ptr<Tree_Node<int>,
decltype(forest_deleter)>
122 unique_ptr<BinNode<int>,
decltype(bp_deleter)>
WeightedDigraph::Node Node
Node for binary search tree.
Forward declaration used by CRTP helpers before the full node definition.
__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 preOrderRec(Node *root, void(*visitFct)(Node *, int, int))
Traverse recursively in preorder a binary tree.
TNode * bin_to_forest(BNode *broot)
Converts a binary tree to its equivalent forest.
void destroy_forest(Node *root)
Destroys (frees memory) the forest whose first tree is root.
int inOrderRec(Node *root, void(*visitFct)(Node *, int, int))
Traverse recursively inorder a binary tree.
void destroyRec(Node *&root) noexcept
Free all the memory occupied by the tree root
void forest_preorder_traversal(Node *root, void(*visitFct)(Node *, int, int))
Preorder traversal of a forest.
BNode * forest_to_bin(TNode *root)
Converts a forest to its equivalent binary tree.
Main namespace for Aleph-w library functions.
bool areEquivalents(Node *t1, Node *t2, Equal &op) noexcept
Return true if trees are equivalents.
static void printNode(Node *node, int, int)
BinNode< int > * random_tree(int l, int r)
Utility functions for binary tree operations.
General tree (n-ary tree) node.