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

Step 3, updating balance factors, is taken straight from TAVL deletion (see Deleting a TAVL Node Step 3 - Update), with the call to find_parent() replaced by inline code that uses pavl_parent.

539. <Steps 3 and 4: Update balance factors and rebalance after PAVL deletion 539> =
while (q != (struct pavl_node *) &tree->pavl_root) 
  { struct pavl_node *y = q; if (y->pavl_parent != NULL) q = y->pavl_parent; else
      q = (struct pavl_node *) &tree->pavl_root; if (dir == 0)
      { dir = q->pavl_link[0] != y; y->pavl_balance++; if (y->pavl_balance == +1) break; else if (y->pavl_balance == +2) {
            <Step 4: Rebalance after PAVL deletion 540>
          } } else
      {
        <Steps 3 and 4: Symmetric case in PAVL deletion 543>
      } } tree->pavl_count–; return (void *) item;

This code is included in 534.