54 try { n =
stoi(
argv[1]); }
catch (...) { n = 1000; }
57 unsigned int t = std::time(0);
60 try { t =
stoul(
argv[2]); }
catch (...) { t = std::time(0); }
65 cout <<
argv[0] <<
" " << n <<
" " << t <<
endl;
75 cerr <<
"Error: n must be greater than 2 for meaningful tree splitting." <<
endl;
79 for (
int i = 0; i < n; i++)
100 cout <<
"Partition key: " << value <<
endl <<
endl;
102 cout <<
"Left Tree" <<
endl;
106 cout <<
"Right Tree" <<
endl;
Core header for the Aleph-w library.
Node for binary search tree.
Node *& getRoot() noexcept
Return the root of tree.
Node * insert(Node *p) noexcept
Insert a node in the tree.
bool split_key_rec(Node *&root, const typename Node::key_type &key, Node *&ts, Node *&tg, const Compare &cmp=Compare()) noexcept
Split recursively according to a key.
bool check_bst(Node *p, const Compare &cmp=Compare())
Return true if p is a binary search tree.
void preOrderThreaded(Node *node, void(*visitFct)(Node *))
Traverse preorder a binary tree without recursion and without stack.
void destroyRec(Node *&root) noexcept
Free recursively all the memory occupied by the tree root
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.
Binary search tree with nodes without virtual destructors,.
static void printNode(BinNode< int > *node)
Utility functions for binary tree operations.
Generic unbalanced binary search tree.