B-Tree implementation in TypeScript
npm install @wecandobetter/btreebash
npm i @wecandobetter/btree
`
Usage
> ⚠️ Not all functionality is implemented yet.
`ts
import { BTree, type Comparator, type Selector } from "@wecandobetter/btree";
const tree = new BTree({
t: 2, // The minimum degree of the tree. Must be >= 2.
comparator: (a, b) => a.localeCompare(b), // the comparator function to use for sorting keys
selector: (a) => a, // the selector function to use to select the value from the input
});
// Insert a value into the tree.
tree.insert("foo");
// Search for a value in the tree.
const results = tree.search("foo"); // returns a Set
``