• Kind of Tree where every node must have 2-4 children, and 1-3 data values.
  • Guarantees operations through Balancing Scheme
  • Structure
    • 2-4 Children
    • 1-3 data values
    • m data values have m + 1 children, and vice versa
    • Nodes grow and shrink with the data
  • Shape > Order > Node
  • Data always gets put into a leaf initially when added
  • When promotion occurs in a node with 3 siblings, promote the value as normally, and split as normally. There will temporarily be 4 data in the parent and 5 children. This will be resolved by the enforcement of balancing scheme, as the parent node will also promote. The overflow will be promoted up the tree in general until resolution.
  • When fusion happens with a parent of one value, there will temporarily be a node with 0 values and children.

Balancing Scheme

TLDR:

  • All leaves must have same depth
  • All Nodes must have 2-4 children
  • All Node must have 1-3 data values.

Shape Property

All leaves must have same depth

Order Property

Node Property

is the nth value is the nth child Each node must have 1-3 data Each node must have 2-4 children

Adding

Similar to other Tree adding methods, adding is simpler than removing

Overflow

  • Recall that every node must have 1 - 3 data. If we add more than this, we enter overflow. In order to resolve overflow with me “promote” one of the middle nodes. This node is either the second or third node, and the choice is arbitrary.
  • When a promotion occurs
    • The promoted value is moved upwards
      • Either into the node above it
      • Into a new root if being promoted from the current root
    • The overflowed node is “split” while maintaining the Order Property.

Removing

Underflow

When removing, we may get a node with 0 values. This is called underflow and it is resolved by Transfer and Fusion.

  • A transfer is preferrable over a fusion, because fusion may propagate underflow up the tree.
  • If you propogate underflow up to the root, it gets deleted.

Transfer

Transfer between parent and child. In either direction. Applicable if the node we are stealing from has multiple data.

Fusion

Fusion between siblings with single data. When Transfer is not an option.

Flowchart