Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 666 Bytes

README.md

File metadata and controls

43 lines (30 loc) · 666 Bytes

rb-interval-tree

Balanced red-black interval tree for Javascript

Build Status

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);
});