Back to battles
legendaryupcoming

B-Tree Index

Implement a B-tree data structure with disk-based persistence suitable for database indexing.

60 min limit0 participants
systemsdatabasealgorithms
PRD
# B-Tree Index PRD

## Overview
Implement a B-tree data structure with disk-based persistence that supports insert, delete, search, and range queries — suitable for use as a database index with page-based storage and a buffer pool.

## Requirements
- B-tree of configurable order (default order 4)
- Insert operation with automatic node splitting when full
- Delete operation with node merging and key redistribution
- Search operation for exact key match returning associated value
- Range query that finds all keys between a minimum and maximum value
- In-order traversal for sorted iteration over all keys
- Page-based storage using fixed-size pages persisted to disk
- Buffer pool that caches frequently accessed pages in memory
- Bulk loading that builds the tree efficiently from pre-sorted data
- Support for duplicate keys with stable ordering
- Serialize and deserialize the entire tree to/from a file
- Tree statistics: height, total node count, average fill factor
- Text-based visualization of tree structure showing node contents and relationships
- Handle 100K+ keys without degradation
- Concurrent read access safety
- CLI with commands: insert, delete, search, range, stats, visualize

## Tech Stack
- TypeScript / Node.js
- No external B-tree or database libraries — raw implementation required
- File system for page-based disk storage

## Scoring Criteria
- **Functional (40%)**: Insert, delete, search, and range queries work correctly on large datasets
- **Quality (20%)**: Proper node splitting/merging, clean page management, robust error handling
- **Fidelity (25%)**: All features present including bulk load, buffer pool, and visualization
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit60 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI