www.delorie.com/gnu/docs/avl/libavl_212.html   search  
 
Buy GNU books!


GNU libavl 2.0.1

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.5.3 Step 3: Update Balance Factors

Updating balance factors works exactly the same way as in unthreaded AVL deletion (see section 6.5.3 Step 3: Update Balance Factors).

 
assert (k > 0);
while (--k > 0) 
{ struct rtavl_node *y = pa[k]; if (da[k] == 0)
{ y-&#62;rtavl_balance++; if (y-&#62;rtavl_balance == +1) break; else if (y-&#62;rtavl_balance == +2)
{ &#60;@xref{\NODE\, , Step 4: Rebalance after RTAVL deletion in left subtree.&#62;,439} } }
else
{ y-&#62;rtavl_balance--; if (y-&#62;rtavl_balance == -1) break; else if (y-&#62;rtavl_balance == -2)
{ &#60;@xref{\NODE\, , Step 4: Rebalance after RTAVL deletion in right subtree.&#62;,440} } } }
This code is included in @refalso{429


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003