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

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

This code is included in 529.

534. <Rebalance for + balance factor in PAVL insertion in right subtree 534> =
<Rotate left at y in AVL tree; avl => pavl 160>
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 533.

535. <Rebalance for - balance factor in PAVL insertion in right subtree 535> =
<Rotate right at x then left at y in AVL tree; avl => pavl 161>
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 533 and 543.