Junior — Middle
Explain what a B-tree is and how it works in databases or file systems.
sobes.tech AI
Answer from AI
B-tree is a balanced search tree optimized for working with large volumes of data stored on external media (disks).
Features of B-tree:
- Each node can contain multiple keys and have multiple children.
- The tree is balanced: all leaves are at the same level.
- A high degree of branching reduces the tree's depth, which decreases the number of disk read operations.
In databases and file systems, B-tree is used for fast search, insertion, and deletion of data, minimizing disk access.
Example: a database index can be implemented as a B-tree, where keys are index values, and leaves contain references to records.