[prev] 51 [next]

Insertion into 2-3-4 Trees

Starting with the root node:

repeat

  • if current node is full (i.e. contains 3 items)
    • split into two 2-nodes
    • promote middle element to parent
      • if no parent ⇒ middle element becomes the new root 2-node
    • go back to parent node
  • if current node is a leaf
    • insert Item in this node, order++
  • if current node is not a leaf
    • go to child where Item belongs
until Item inserted