95# define DIFF(p) ((p)->getDiff())
122 template <
class Node>
125 if (p == Node::NullPtr)
141 if (
static_cast<int>(
DIFF(p)) !=
hR -
hL)
bool is_avl(Node *p)
Validate that a tree satisfies AVL properties.
#define DIFF(p)
Access the balance factor of node p.
WeightedDigraph::Node Node
Data portion of an AVL tree node.
signed char & getDiff() noexcept
Get reference to balance factor.
void reset() noexcept
Reset balance factor to 0 (for reuse)
signed char diff
Balance factor: height(right) - height(left)
AvlNode_Data() noexcept
Default constructor initializes balance to 0 (equal heights)
Declare AvlNode type with 40-byte pool allocation.
#define DECLARE_BINNODE(Name, height, Control_Data)
Specify tree node for a binary tree.
size_t computeHeightRec(Node *root) noexcept
Compute recursively the height of root
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.
bool diff(const C1 &c1, const C2 &c2, Eq e=Eq())
Check if two containers differ.
Utility functions for binary tree operations.