53int main(
int argc,
char *argv[])
55 int n = argc > 1 ? atoi(argv[1]) : 10;
57 unsigned int t = std::time(0);
64 cout << argv[0] <<
" " << n <<
" " << t << endl;
69 for (i = 0; i < n; i++)
73 value = (int) (10.0*n*rand()/(RAND_MAX+1.0));
83 cout << endl <<
"T1" << endl;
87 for (i = 0; i < n; i++)
91 value = (int) (10.0*n*rand()/(RAND_MAX+1.0));
102 cout << endl <<
"T2" << endl;
112 cout << endl <<
"Join(T1, T2)" << endl;
120 cout << endl <<
"Join(T2, T1)" << endl;
128 for (i = 0; i < n; ++i)
143 cout <<
"join(t1, t2, dup): ";
Core header for the Aleph-w library.
WeightedDigraph::Node Node
size_t size_t int32_t value
Node for binary search tree.
static BinNode *const NullPtr
__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.
Node * copyRec(Node *root)
Copy a tree.
bool check_bst(Node *p, const Compare &cmp=Compare())
Return true if p is a binary search tree.
Node * insert_in_bst(Node *&r, Node *p, const Compare &cmp=Compare()) noexcept
Insert a node p in a binary search tree.
void destroyRec(Node *&root) noexcept
Free all the memory occupied by the tree root
Node * searchInBinTree(Node *root, const typename Node::key_type &key, const Compare &cmp=Compare()) noexcept(nothrow_compare_v< Compare, typename Node::key_type >)
Search a key in a binary search tree using optimistic search.
Node * insert_root(Node *&root, Node *p, const Compare &cmp=Compare()) noexcept
Insert the node p as root of a binary search tree.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
std::ostream & join(const C &c, const std::string &sep, std::ostream &out)
Join elements of an Aleph-style container into a stream.
void print_node(Node *p, int, int)
Utility functions for binary tree operations.
Extended binary node with subtree count.