b-trees

Published

2023-08-05

B-trees are useful when our data are stored on disk. Every disk I/O operation is expensive so we try to keep these to a minimum. Accordingly, we want to reduce the height of our tree, since every level means more disk I/O. We accomplish this by allowing more branches from each node and by allowing multiple values at each leaf (in a linked list). B-trees are not binary trees; that is, a B-tree is an M-ary structure

Here’s a demonstration using the USF algorithm visualization tool.

Now try the algorithm visualization tool yourself. Try performing this sequence of insertions, searches, and deletions. Be aware that this visualization is a little different from the presentation given above—but the concepts at work are the same. As you perform operations, try to anticipate what will happen next before you trigger the visualization.

https://www.cs.usfca.edu/~galles/visualization/BTree.html

Comprehension check

  1. An M-ary tree structure is one which allows up to ____________ branches from a given node.
  2. If an insertion would produce a leaf with L + 1 elements, we ___________ the leaf.
  3. If a deletion would produce a leaf with fewer than \lceil L / 2 \rceil elements we ___________ leaves.
  4. The objective of a B-tree is to keep the tree as _________________ as possible.

Answers: ʍollɐɥs ’ǝƃɹǝɯ ’ʇᴉlds ’W

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

All materials copyright © 2020–2023, The University of Vermont. All rights reserved.