14.5.4 Symmetric Case [ToC] [Index]     [Skip Back]     [Prev] [Up] [Next]

545. <Steps 3 and 4: Symmetric case in PAVL deletion 545> =
dir = q->pavl_link[0] != y;
y->pavl_balance--;
if (y->pavl_balance == -1)
  break;
else if (y->pavl_balance == -2) 
  { struct pavl_node *x = y->pavl_link[0]; if (x->pavl_balance == +1) {
        <Right-side rebalancing case 1 in PAVL deletion 546>
      } else
      {
        <Right-side rebalancing case 2 in PAVL deletion 547>
      } }

This code is included in 541.

546. <Right-side rebalancing case 1 in PAVL deletion 546> =
struct pavl_node *w;
<Rebalance for + balance factor in PAVL insertion in left subtree 532>
q->pavl_link[dir] = w;

This code is included in 545.

547. <Right-side rebalancing case 2 in PAVL deletion 547> =
y->pavl_link[0] = x->pavl_link[1];
x->pavl_link[1] = y;
x->pavl_parent = y->pavl_parent;
y->pavl_parent = x;
if (y->pavl_link[0] != NULL)
  y->pavl_link[0]->pavl_parent = y;
q->pavl_link[dir] = x;
if (x->pavl_balance == 0) 
  { x->pavl_balance = +1; y->pavl_balance = -1; break; }
else
  { x->pavl_balance = y->pavl_balance = 0; y = x; }

This code is included in 545.