11.5.3 Step 3: Update Balance Factors [ToC] [Index]     [Skip Back] [Skip Fwd]     [Prev] [Up] [Next]

Updating balance factors works exactly the same way as in unthreaded AVL deletion (see Deleting an AVL Node Step 3 - Update).

440. <Steps 3 and 4: Update balance factors and rebalance after RTAVL deletion 440> =
assert (k > 0);
while (--k > 0) 
  { struct rtavl_node *y = pa[k]; if (da[k] == 0)
      { y->rtavl_balance++; if (y->rtavl_balance == +1) break; else if (y->rtavl_balance == +2)
          { <Step 4: Rebalance after RTAVL deletion in left subtree 441> } }
    else
      { y->rtavl_balance--; if (y->rtavl_balance == -1) break; else if (y->rtavl_balance == -2)
          { <Step 4: Rebalance after RTAVL deletion in right subtree 442> } } }

This code is included in 431.