Inserting into an RTAVL Tree - GNU libavl 2.0.2
Author: Ben Pfaff

11.4 Insertion |

Insertion into an RTAVL tree follows the same pattern as insertion into other kinds of balanced tree. The outline is straightforward:

    419. <RTAVL item insertion function 419> =
    void **
    rtavl_probe (struct rtavl_table *tree, void *item)
    {
      <avl_probe() local variables; avl => rtavl 147>

      assert (tree != NULL && item != NULL);

      <Step 1: Search RTAVL tree for insertion point 420>
      <Step 2: Insert RTAVL node 421>
      <Step 3: Update balance factors after AVL insertion; avl => rtavl 150>
      <Step 4: Rebalance after RTAVL insertion 422>
    }

This code is included in 418.