51# define COLOR(p) ((p)->getColor())
97 if (p == Node::NullPtr)
123 if (node == Node::NullPtr)
146 if (node == Node::NullPtr)
150 if (node->getCount() !=
LLINK(node)->getCount() +
RLINK(node)->getCount() + 1)
169template <
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.
constexpr Node *& RLINK(Node *p) noexcept
Return the right tree of p.
constexpr Node *& LLINK(Node *p) noexcept
Return a pointer to left subtree.
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.
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.
DynList< T > maps(const C &c, Op op)
Classic map operation.
#define BLACK
Black color constant.
#define RED
Red color constant (newly inserted nodes are red)
Basic binary tree node definitions.