12.4 Deletion |
The process of deletion from an RTRB tree is the same that we've seen many times now. Code for the first step is borrowed from RTAVL deletion:
468. <RTRB item deletion function 468> = void *
rtrb_delete (struct rtrb_table *tree, const void *item)
{ struct rtrb_node *pa[RTRB_MAX_HEIGHT]; /* Nodes on stack. */ unsigned char da[RTRB_MAX_HEIGHT]; /* Directions moved from stack nodes. */ int k; /* Stack height. */ struct rtrb_node *p; assert (tree != NULL && item != NULL); <Step 1: Search RTAVL tree for item to delete; rtavl => rtrb 430> <Step 2: Delete RTRB node 469> <Step 3: Rebalance after RTRB deletion 474> <Step 4: Finish up after RTRB deletion 481> }
This code is included in 455.