51# define COLOR(p) ((p)->getColor())
99 if (p == Node::NullPtr)
129 if (p == Node::NullPtr)
132 if (p->getCount() !=
LLINK(p)->getCount() +
RLINK(p)->getCount() + 1)
153 return left_height + (
COLOR(p) ==
BLACK ? 1 : 0);
164 if (node == Node::NullPtr)
200template <
class Node,
class Compare>
SentinelCtor
Tag type for sentinel node construction.
WeightedDigraph::Node Node
Red-Black node data with color and subtree count.
RbNodeRk_Data(SentinelCtor) noexcept
size_t & getCount() noexcept
Color & getColor() noexcept
Extended Red-Black node with subtree counter.
__gmp_expr< typename __gmp_resolve_expr< T, V >::value_type, __gmp_binary_expr< __gmp_expr< T, U >, __gmp_expr< V, W >, __gmp_max_function > > max(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
int cmp(const __gmp_expr< T, U > &expr1, const __gmp_expr< V, W > &expr2)
#define DECLARE_BINNODE_SENTINEL(Name, height, Control_Data)
Specify tree node for a binary tree.
bool check_bst(Node *p, const Compare &cmp=Compare())
Return true if p is a binary search tree.
Main namespace for Aleph-w library functions.
bool is_red_black_bst_rk(Node *node, Compare &cmp)
Verify that tree rooted at node is a valid red-black BST with counters.
bool is_red_black_tree_rk(Node *node)
Verify if tree is a valid red-black tree with correct counters.
int red_black_height_rk(Node *p) noexcept
Black height of a ranked red-black subtree, checking all its nodes.
and
Check uniqueness with explicit hash + equality functors.
bool test_black_condition_rk(Node *p, int &max, int bh=0)
Test the black height condition for a red-black tree.
bool is_red_black_rk(Node *node)
Verify if tree rooted at node is a valid red-black tree.
#define BLACK
Black color constant.
#define RED
Red color constant (newly inserted nodes are red)
Basic binary tree node definitions.