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:
470. <RTRB item deletion function 470> = 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 432> <Step 2: Delete RTRB node 471> <Step 3: Rebalance after RTRB deletion 476> <Step 4: Finish up after RTRB deletion 483> }
This code is included in 457.