Implementation of Algs4 Red Black BST in javascript with no dependencies.
This project is an implementation of red-black binary search for multi purpose. Common uses are: data caching, sort, indexing, etc...
$ npm i red-black-bstconst BST = require('red-black-bst');
const bst = new BST();
bst.put('my key', {mydata: 'is this'})
console.log(bst.get('my key'))Methods for create, read, update and delete nodes in tree.
Creating or update node in tree.
bst.put('my key', {mydata: 'is this'})Get key content in tree.
bst.get('my key')bst.delete('my key')Methods for query in the tree.
Get min key in the tree.
bst.min()Get max key in the tree.
bst.min()Get number of keys less than key queried.
bst.rank('my key')Get data in the by rank position.
bst.select(10)Get key less then or equal key queried.
bst.floor('my key')Get key greater then or equal key queried.
bst.ceilling('my key')Get all keys between interval keys queried.
bst.keysInRange('first key', 'last key')