50 cout << node->get_key() <<
" ";
55 cout << node->getPriority() <<
" ";
64 try { n =
stoi(
argv[1]); }
catch (...) { n = 10; }
69 cerr <<
"n must be positive" <<
endl;
73 unsigned int t = std::time(0);
76 try { t =
stoul(
argv[2]); }
catch (...) { t = std::time(0); }
81 cout <<
"testTreap_Rk " << n <<
" " << t <<
endl;
88 cout <<
"Inserting " << n <<
" random values in tree ...\n";
90 for (i = 0; i < n; i++)
110 <<
"Preorden" <<
endl;
116 cout <<
"inorden prio" <<
endl;
120 for (i = 0; i < n; i++)
123 cout << node->get_key() <<
" ";
128 cout <<
"Lista de posiciones infijas" <<
endl;
130 for (i = 0; i < n; ++i)
132 std::pair<int,Treap_Rk<int>::Node*> pos = tree.
position(
keys[i]);
133 cout <<
keys[i] <<
"<-->" << pos.first <<
endl;
138 for (i = 0; i < n/2; i++)
144 cout <<
value <<
" ";
148 cout <<
endl <<
"verifying Treap_Rk after deletions ... "
152 cout <<
" done" <<
endl;
154 cout <<
"Preorden" <<
endl;
158 cout <<
"inorden prio" <<
endl;
165 cout <<
"Recorrido por iterador" <<
endl;
167 cout <<
KEY(it.get_curr()) <<
" ";
173 cout <<
"Eliminacion de rango [" <<
beg <<
" .. " << end <<
"]" <<
endl;
183 cout <<
"Arbol restante" <<
endl;
187 cout <<
"Arbol eliminado" <<
endl;
194 cout <<
endl <<
"testTreap_Rk " << n <<
" " << t <<
endl;
Core header for the Aleph-w library.
size_t size_t int32_t value
Node *& getRoot() noexcept
Return the tree's root.
Node * select(const size_t i) const
Return the i-th node in order sense.
size_t size() const noexcept
Return the number of nodes contained in the tree.
Node * search(const Key &key) const noexcept
Search a key in a treap.
Node * remove(Node *&root, const Key &key) noexcept
bool insert(Node *&root, Node *p) noexcept
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
int preOrderRec(Node *root, void(*visitFct)(Node *, int, int))
Traverse recursively in preorder a binary tree.
bool check_rank_tree(Node *root) noexcept
Return true if root is a valid extended binary tree.
std::pair< int, Node * > position(const Key &key) const noexcept
Compute the inorder position of a key.
size_t internal_path_length(Node *p) noexcept
Compute the internal path length.
int inOrderRec(Node *root, void(*visitFct)(Node *, int, int))
Traverse recursively inorder a binary tree.
void destroyRec(Node *&root) noexcept
Free recursively all the memory occupied by the tree root
Main namespace for Aleph-w library functions.
bool is_treap(Node *root) noexcept
Validate that a tree satisfies treap (heap) property.
Extended treap (a special type of randomized binary search tree) which manages selection and splittin...
void printNode(Treap_Rk< int >::Node *node, int, int)
void printPrio(Treap_Rk< int >::Node *node, int, int)
Utility functions for binary tree operations.
Lazy and scalable dynamic array implementation.
Treap with rank (order statistics).