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


GNU libavl 2.0.1

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

7.5.4 Symmetric Case

 
struct rb_node *w = pa[k - 1]-&#62;rb_link[0];
if (w-&#62;rb_color == RB_RED)
  { 
&#60;@xref{\NODE\, , Ensure w.&#62; is black in right-side RB deletion rebalancing,234}
} if ((w-&#62;rb_link[0] == NULL
|| w-&#62;rb_link[0]-&#62;rb_color == RB_BLACK) && (w-&#62;rb_link[1] == NULL
|| w-&#62;rb_link[1]-&#62;rb_color == RB_BLACK)) { &#60;@xref{\NODE\, , Case 1 in right-side RB deletion rebalancing.&#62;,235} } else
{ if (w-&#62;rb_link[0] == NULL
|| w-&#62;rb_link[0]-&#62;rb_color == RB_BLACK) {
&#60;@xref{\NODE\, , Transform right-side RB deletion rebalancing case 3 into case 2.&#62;,236}
} &#60;@xref{\NODE\, , Case 2 in right-side RB deletion rebalancing.&#62;,237} break; }
This code is included in @refalso{226

 
w-&#62;rb_color = RB_BLACK;
pa[k - 1]-&#62;rb_color = RB_RED;
pa[k - 1]-&#62;rb_link[0] = w-&#62;rb_link[1];
w-&#62;rb_link[1] = pa[k - 1];
pa[k - 2]-&#62;rb_link[da[k - 2]] = w;
pa[k] = pa[k - 1];
da[k] = 1;
pa[k - 1] = w;
k++;
w = pa[k - 1]-&#62;rb_link[0];
This code is included in @refalso{233

 
w-&#62;rb_color = RB_RED;
This code is included in @refalso{233

 
struct rb_node *y = w-&#62;rb_link[1];
y-&#62;rb_color = RB_BLACK;
w-&#62;rb_color = RB_RED;
w-&#62;rb_link[1] = y-&#62;rb_link[0];
y-&#62;rb_link[0] = w;
w = pa[k - 1]-&#62;rb_link[0] = y;
This code is included in @refalso{233

 
w-&#62;rb_color = pa[k - 1]-&#62;rb_color;
pa[k - 1]-&#62;rb_color = RB_BLACK;
w-&#62;rb_link[0]-&#62;rb_color = RB_BLACK;
pa[k - 1]-&#62;rb_link[0] = w-&#62;rb_link[1];
w-&#62;rb_link[1] = pa[k - 1];
pa[k - 2]-&#62;rb_link[da[k - 2]] = w;
This code is included in @refalso{233


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