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


GNU libavl 2.0.1

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

12.5 Deletion

Deletion in an RTAVL tree takes the usual pattern.

 
void *
rtavl_delete (struct rtavl_table *tree, const void *item)
{ /* Stack of nodes. */ struct rtavl_node *pa[RTAVL_MAX_HEIGHT]; /* Nodes. */ unsigned char da[RTAVL_MAX_HEIGHT]; /* rtavl_link[] indexes. */ int k; /* Stack pointer. */ struct rtavl_node *p; /* Traverses tree to find node to delete. */ assert (tree != NULL && item != NULL); &#60;@xref{\NODE\, , Step 1: Search RTAVL tree for item to delete.&#62;,430} &#60;@xref{\NODE\, , Step 2: Delete RTAVL node.&#62;,431} &#60;@xref{\NODE\, , Steps 3 and 4: Update balance factors and rebalance after RTAVL deletion.&#62;,438} return (void *) item; }
This code is included in @refalso{418

12.5.1 Step 1: Search  
12.5.2 Step 2: Delete  
12.5.3 Step 3: Update Balance Factors  
12.5.4 Step 4: Rebalance  


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