52 cerr <<
"Invalid value for n: " <<
argv[1] <<
" (must be between 1 and 1,000,000)" <<
endl;
58 auto t =
static_cast<unsigned int> (
time (
nullptr));
61 if (
argv[2][0] ==
'-')
63 cerr <<
"Invalid value for t (must be non-negative): " <<
argv[2] <<
endl;
74 t =
static_cast<unsigned int>(
parsed_t);
83 std::uniform_int_distribution<int> dist(1,
upper);
85 cout <<
"testSplayTree " << n <<
" " << t <<
endl;
89 cout <<
"Inserting " << n <<
" random values in tree ...\n";
93 while (
insCount <
static_cast<unsigned int>(n))
95 const int value = dist(
rng);
107 cout <<
"arbol equilibrado" <<
endl;
110 cout <<
"error de equilibrio en el arbol" <<
endl;
116 cout <<
"testSplayTree " << n <<
" " << t <<
endl;
Node * insert(Node *p)
Inserts a node in a top down splay tree.
Node * search(const Key &key)
Searches a key in a top down splay tree.
Node *& getRoot()
Get the top-down splay tree's root.
void destroyRec(Node *&root) noexcept
Free recursively all the memory occupied by the tree root
void exit(const char *file, int line, const char *format,...)
Print a message and exit the program.
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.
Extended binary node with subtree count.
Top-down splay tree with rank support.