50 file << p->get_key() <<
" ";
63 output << p->get_key() <<
" ";
77 unsigned int t = std::time(0);
82 try { n = std::stoi(
argv[1]); }
83 catch (
const std::exception & e)
85 cerr <<
"Warning: could not parse n from '" <<
argv[1]
86 <<
"': " << e.what() <<
". Using default n=1000" <<
endl;
92 try { t = std::stoi(
argv[2]); }
93 catch (
const std::exception & e)
95 cerr <<
"Warning: could not parse t from '" <<
argv[2]
96 <<
"': " << e.what() <<
". Using default t=" << t <<
endl;
102 cout <<
"n must be positive" <<
endl;
108 output.open(
"rb-example-aux.Tree", ios::out);
111 cerr <<
"Error: could not open rb-example-aux.Tree for writing" <<
endl;
115 file.open(
"rb-tree-aux.Tree", ios::out);
118 cerr <<
"Error: could not open rb-tree-aux.Tree for writing" <<
endl;
122 cout <<
"writeRb " << n <<
" " << t <<
endl;
129 for (i = 0; i < 30; i++)
134 node = tree.
search(value);
154 for (i = 0; i < n; i++)
159 node = tree.
search(value);
168 file <<
"START-SHADOW ";
Core header for the Aleph-w library.
Node * insert(Node *p) noexcept
Insert a node into the tree.
Node * search(const Key &key) const noexcept
Search for a key in the tree.
Node *& getRoot() noexcept
Get reference to root pointer.
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.
#define RED
Red color constant (newly inserted nodes are red)
bool is_red_black(Node *node)
Test all Red-Black tree properties for a node.
Red-black tree with nodes without virtual destructor.
Utility functions for binary tree operations.
Red-Black tree implementation (bottom-up balancing).
static void print_color_ex(const Rb_Tree< int >::Node *p, int, int pos)
static void print_color(const Rb_Tree< int >::Node *p, int, int pos)
static void print_key(const Rb_Tree< int >::Node *p, int, int)
static void print_key_ex(const Rb_Tree< int >::Node *p, int, int)