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


GNU libavl 2.0.1

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

16.3.3 Symmetric Case

 
struct prb_node *y = g-&#62;prb_link[0];
if (y != NULL && y-&#62;prb_color == PRB_RED)
  { 
&#60;@xref{\NODE\, , Case 1 in right-side PRB insertion rebalancing.&#62;,563}
} else
{ struct prb_node *h; /* Great-grandparent of q. */ h = g-&#62;prb_parent; if (h == NULL) h = (struct prb_node *) &tree-&#62;prb_root; if (f-&#62;prb_link[0] == q) {
&#60;@xref{\NODE\, , Case 3 in right-side PRB insertion rebalancing.&#62;,565}
} &#60;@xref{\NODE\, , Case 2 in right-side PRB insertion rebalancing.&#62;,564} break; }
This code is included in @refalso{557

 
f-&#62;prb_color = y-&#62;prb_color = PRB_BLACK;
g-&#62;prb_color = PRB_RED;
q = g;
This code is included in @refalso{562

 
g-&#62;prb_color = PRB_RED;
f-&#62;prb_color = PRB_BLACK;
g-&#62;prb_link[1] = f-&#62;prb_link[0];
f-&#62;prb_link[0] = g;
h-&#62;prb_link[h-&#62;prb_link[0] != g] = f;
f-&#62;prb_parent = g-&#62;prb_parent;
g-&#62;prb_parent = f;
if (g-&#62;prb_link[1] != NULL)
  g-&#62;prb_link[1]-&#62;prb_parent = g;
This code is included in @refalso{562

 
f-&#62;prb_link[0] = q-&#62;prb_link[1];
q-&#62;prb_link[1] = f;
g-&#62;prb_link[1] = q;
f-&#62;prb_parent = q;
if (f-&#62;prb_link[0] != NULL)
  f-&#62;prb_link[0]-&#62;prb_parent = f;
f = q;
This code is included in @refalso{562


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