rb-interval-tree
v2.0.2
Published
Balanced interval tree
Downloads
12
Maintainers
Readme
rb-interval-tree
Balanced red-black interval tree for Javascript
Usage
const IntervalTree = require('rb-interval-tree');
const tree = new IntervalTree();
Insertion
tree.insert(4, 7, 'foo');
Search
const results = tree.search(0, 10);
Removal
tree.remove('foo');
Copy
const dup = tree.copy();
Traversal (in order)
tree.visit((value, start, end) => {
console.log(value, start, end);
});