NewWork mode: your Claude Code or Codex on work calls, answering from your project's codeSkip to content
Senior1 view

What is a B-tree?

Practice

Asked at

AI answer

A B-tree (balanced search tree) is a data structure whose nodes can contain multiple keys and references to child nodes. The keys in each node are ordered, and the leaves are at roughly the same depth, so the tree remains balanced. Searching, insertion, and deletion typically take O(log n) operations. In databases, B-tree-like indexes make it possible to find records quickly and perform range queries while reducing the number of disk accesses.