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

531. <Rebalance PAVL tree after insertion in right subtree 531> =
struct pavl_node *x = y->pavl_link[1];
if (x->pavl_balance == +1)
  { 
    <Rebalance for + balance factor in PAVL insertion in right subtree 532>
  } else
  {
    <Rebalance for - balance factor in PAVL insertion in right subtree 533>
  }

This code is included in 527.

532. <Rebalance for + balance factor in PAVL insertion in right subtree 532> =
<Rotate left at y in AVL tree; avl => pavl 158>
x->pavl_parent = y->pavl_parent;
y->pavl_parent = x;
if (y->pavl_link[1] != NULL)
  y->pavl_link[1]->pavl_parent = y;

This code is included in 531.

533. <Rebalance for - balance factor in PAVL insertion in right subtree 533> =
<Rotate right at x then left at y in AVL tree; avl => pavl 159>
w->pavl_parent = y->pavl_parent;
x->pavl_parent = y->pavl_parent = w;
if (x->pavl_link[0] != NULL)
  x->pavl_link[0]->pavl_parent = x;
if (y->pavl_link[1] != NULL)
  y->pavl_link[1]->pavl_parent = y;

This code is included in 531 and 541.