Algorithms and Data Structures · Senior · Question 14 of 75

Why do databases use B-trees rather than binary search trees for indexes?

Explanation

A node holds hundreds of keys, so a tree over millions of rows is only 3-4 levels deep, and each level is one disk page read. A binary tree would be about 20 levels with poor locality.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 14

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz