A dynamically balanced B+ Tree index providing guaranteed
Traditional binary search trees and standard B-Trees are excellent for localized point lookups. However, if you need to execute a range query (e.g., extracting all sorted keys between
Our B+ Tree solves this bottleneck by completely separating the routing layer from the actual data storage layer. Internal nodes (CTBPlusTreeInternalNode) store strictly routing-key separators to direct search trajectories down the tree, while all actual key-value payloads reside exclusively inside terminal leaf nodes (CTBPlusTreeLeafNode).
Furthermore, it guarantees nextLeaf pointer. When reading a block of sequential data, the engine performs a single
To install Containers-BPlusTree, open the Playground (Ctrl + O + W) in your Pharo image and execute the following Metacello script:
Metacello new
baseline: 'ContainersBPlusTree';
repository: 'github://pharo-containers/Containers-BPlusTree/src';
load.CTBPlusTree pays a minor structural maintenance tax on mutations to keep its depth shallow, but in return, it completely vitalizes massive sequential workflows, guaranteeing flat algorithmic complexities across intense transactional volumes.
| Operation | CTBPlusTree (Indexed Order |
|---|---|
| Insert Key |
|
| Point Lookup |
|
| Range Scan ( |
|
| Delete Key |
|
| Memory Locality | Contiguous key-value blocks |
-
$O(\log N)$ Balanced Depth Invariants: Structural mutations bubble up via single-responsibilityCTBPlusTreePromotionandCTBPlusTreeUnderflowmessengers, keeping the tree uniformly shallow even under adversarial workloads.
"Create a new B+ Tree with an industrial branching factor of 100"
tree := CTBPlusTree new.
tree order: 100.
"Insert elements with associative payloads"
tree at: 10 put: 'User_Profile_A'.
tree at: 50 put: 'User_Profile_B'.
tree at: 20 put: 'User_Profile_C'.
"Point lookups operate in strict logarithmic time"
tree at: 50. "=> 'User_Profile_B'"
"Safe functional fallback lookup"
tree at: 999 ifAbsent: [ 'Guest_Profile' ].
"Dynamically remove a key. Sibling nodes automatically borrow or merge to balance memory"
tree removeKey: 20.This library is part of the Pharo Containers project. Contributions are welcome, whether implementing additional functional combinators, improving test coverage, or enhancing documentation. Please open an issue or pull request on GitHub.