The Balance of B-Trees
Because B-trees grow (and shrink), they always maintain a kind of balance. To be specific, all leaf nodes of a B-tree are always on the same level of the tree. It’s not like one path of the tree can end on the second level while another path stretches down to the fourth level. Because new values are only inserted into leaf nodes, and the tree only grows upwards, leaf nodes cannot possibly end up on different levels of the tree.
Another way to look at this is that if I try to make one branch of the tree fatter than the others, at some point, I’ll end up failing. This is because if I make one node too fat, it ends up splitting! And once it splits, all parts of the tree grow at the same rate, and not only that branch.
Ultimately, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access