Query Quest

Discover why databases use B-trees

Back to Labs

The Sorted Insert Problem

What happens when you insert sorted data?

B-trees stay balanced even with sorted inserts. Binary trees become linked lists!

Binary Search Tree

Height: 0 | Nodes: 0

Empty tree

B-Tree (order 2)

Height: 0 | Nodes: 0

Empty tree. Insert some keys to visualize.

Let's insert numbers 1 through 7 in order into both trees. Watch carefully!