treeducer
Installation
$ npm install --save treeducer
Usage
import { Treeducer } from "treeducer";
let tree = new Treeducer({
cmp(a: number, b: number) {
return a - b;
},
map(a: number): number {
return a;
},
reduce(a: number, b: number) {
return a + b;
}
});
tree = tree
.insert(1)
.insert(2)
.insert(3)
.delete(2);
tree.reduce(); // 4
License
This library is licensed under the MIT license. See LICENSE.