11.4 Insertion |
Insertion into an RTAVL tree follows the same pattern as insertion into other kinds of balanced tree. The outline is straightforward:
421. <RTAVL item insertion function 421> = void **
rtavl_probe (struct rtavl_table *tree, void *item)
{ <avl_probe() local variables; avl => rtavl 149> assert (tree != NULL && item != NULL); <Step 1: Search RTAVL tree for insertion point 422> <Step 2: Insert RTAVL node 423> <Step 3: Update balance factors after AVL insertion; avl => rtavl 152> <Step 4: Rebalance after RTAVL insertion 424> }
This code is included in 420.