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


GNU libavl 2.0.1

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

10.4 Deletion

The outline for the deletion function follows the usual pattern.

 
void *
trb_delete (struct trb_table *tree, const void *item)
{ struct trb_node *pa[TRB_MAX_HEIGHT]; /* Nodes on stack. */ unsigned char da[TRB_MAX_HEIGHT]; /* Directions moved from stack nodes. */ int k = 0; /* Stack height. */ struct trb_node *p; int cmp, dir; assert (tree != NULL && item != NULL); &#60;@xref{\NODE\, , Step 1: Search TRB tree for item to delete.&#62;,350} &#60;@xref{\NODE\, , Step 2: Delete item from TRB tree.&#62;,351} &#60;@xref{\NODE\, , Step 3: Rebalance tree after TRB deletion.&#62;,356} &#60;@xref{\NODE\, , Step 4: Finish up after TRB deletion.&#62;,362} }
This code is included in @refalso{336

10.4.1 Step 1: Search  
10.4.2 Step 2: Delete  
10.4.3 Step 3: Rebalance  
10.4.4 Step 4: Finish Up  
10.4.5 Symmetric Case  


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