A B-tree of order 4 and of height 3 will have a maximum of _______ keys.

(a) 255

(b) 63

(c) 127

(d) 188

I would like to ask this question from B-Trees in portion B-Trees of Data Structures & Algorithms I

I had been asked this question during an interview for a job.

1 Answers

The correct choice is (a) 255

Easiest explanation – A B-tree of order m of height h will have the maximum number of keys when all nodes are completely filled. So, the B-tree will have n = (m^h+1 – 1) keys in this situation. So, required number of maximum keys = 4^3+1 – 1 = 256 – 1 = 255.