AlgoScope

2-3-4 Tree

Data structureadvancedBalanced Search Trees

Nodes hold one to three keys; isomorphic to red-black trees.

Decision · step 6 of 18B-Tree: A 2-3-4 tree: three keys per node
10 20 50 70×

10 20 50 70 has 4 keys and the limit is 3, so it splits. The middle key, 50, moves up to the parent; the keys below it form the left node and the keys above it the right node.

Open in the player →or start at step 6

What you will see

A 4-node splits on the way down so insertion never needs to back up.

How b-tree works →

Cost

searchO(log n)
insertO(log n)
deleteO(log n)
SpaceO(n)

How you work with it here

play it through, step one change at a time, scrub to any step, run it on your own input, try operations in any order.

Screen readers: Each element is an accessibility element with position, value and state; structural changes are announced per step.

Reduced motion: Elements appear at their destination with a crossfade; no travel longer than the element's own size.

Before this

Taught by the same lesson

B-Tree covers these too, in the same run.