The home where you level up

Save my spot

B-Tree

Term side of the Card.
Topic: Tree
Unit title: B-Tree
Categories: Data structure
Explanation side of the Card

Explanation: The multi-level, balanced tree structure that keeps data sorted and allows searches, insertions and deletions in logarithmic time. Suitable for storage systems needing fast data access.

Common mistakes

  • Confusing a B-tree with a binary tree; B-tree nodes hold many keys and many children.
  • Expecting a B-tree index to speed up LIKE '%term'; a leading wildcard cannot use it.

Interview questions

B-tree vs binary search tree: what is the difference?

A B-tree node holds many keys and has many children, so the tree is short and wide. That means far fewer disk or page reads per lookup.

What is the time complexity of a B-tree?

Search, insert and delete are O(log n). The number of node reads is about log base m of n, where m is the branching factor.

B-tree vs B+ tree: which do databases use?

Most relational database indexes use B+ trees, where records sit in linked leaves, which makes range scans fast.

The home where you level up

Daily 3-minute lessons to understand your AI's code.

No spam — just launch news.
Unsubscribe anytime. · Privacy Policy

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy