74# define COLOR(p) ((p)->getColor())
130 template <
class Node>
135 if (p == Node::NullPtr)
163 template <
class Node>
166 if (p == Node::NullPtr)
187 return left_height + (
COLOR(p) ==
BLACK ? 1 : 0);
202 template <
class Node>
205 if (node == Node::NullPtr)
233 template <
class Node>
250 template <
class Node,
class Compare>
256 return check_bst(node,
cmp);
SentinelCtor
Tag type for sentinel node construction.
WeightedDigraph::Node Node
Data portion of a Red-Black tree node.
Color & getColor()
Get reference to node color.
Color color
Node color: RED or BLACK.
void reset()
Reset node to red (for reinsertion)
RbNode_Data() noexcept
Default constructor creates a red node.
Color getColor() const
Get node color.
RbNode_Data(SentinelCtor) noexcept
Sentinel constructor creates a black node.
Declare RbNode type with 128-byte pool allocation.
__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.
#define COLOR(p)
Access the color of node p.
int red_black_height(Node *p) noexcept
Black height of a red-black subtree, checking all its nodes.
bool is_red_black_bst(Node *node, Compare &cmp)
Verify that tree is both a valid RB tree and valid BST.
bool test_black_condition(Node *p, int &max, int bh=0)
Test the black-height property of an RB tree.
#define BLACK
Black color constant.
#define RED
Red color constant (newly inserted nodes are red)
bool is_red_black_tree(Node *node)
Test RB properties for entire subtree.
unsigned char Color
Color type for RB nodes.
bool is_red_black(Node *node)
Test all Red-Black tree properties for a node.
Basic binary tree node definitions.