34# include <gsl/gsl_rng.h>
45 cout <<
KEY(p) <<
" " ;
51 cout <<
KEY(p) <<
" " ;
61 catch (...) { n = 1000; }
66 cerr <<
"Error: n must be a positive integer." <<
endl;
70 unsigned int seed = 0;
74 catch (...) {
seed = 0; }
80 cout <<
"test_Splay_Tree " << n <<
" " <<
seed <<
endl;
87 cout <<
"Testing for insertions" <<
endl;
89 for (
int i = 0; i < n; i++)
108 cout <<
endl <<
"Preorder " <<
endl;
113 cout <<
"Testing for random searches" <<
endl;
114 for (
int i = 0; i < n; ++i)
117 int value = values(idx);
118 cout <<
value <<
" ";
120 AH_ERROR(
"BUG detected ins searching");
122 cout <<
"Done" <<
endl;
124 cout <<
"Removing test" <<
endl;
126 for (
int i = 0; i < n/7; i++)
130 cout <<
value <<
" ";
144 DynList<int>({122, 363, 1247, 510, 701, 1565, 1157, 728, 1564, 492, 861, 422}).
149 cout <<
endl <<
"Preorder " <<
endl;
#define AH_ERROR(...)
Print an error message (always enabled).
size_t size_t int32_t value
Set-like container backed by a dynamic array.
void remove(T &item)
Given a valid reference to an item in the array, it removes it and decrease the dimension.
size_t size() const noexcept
Return the current dimension of array.
T & append()
Allocate a new entry to the end of array.
Doubly-linked list (defined in tpl_dynList.H).
Node *& getRoot() noexcept
Get the top-down splay tree's root.
Node * remove(const Key &key) noexcept
Remove a key from a top down splay tree.
Node * insert(Node *p) noexcept
Inserts a node in a top-down splay tree.
Node * search(const Key &key) noexcept
Searches a key in a top-down splay tree.
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.
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
Operation for_each(Itor beg, const Itor &end, Operation op)
Apply an operation to each element in a range.
void print_node(Splay_Tree< int >::Node *p, int, int)
void write_node(Splay_Tree< int >::Node *p, int, int)
Top-down splay tree implementation (without rank support).