Package Exports
- @onesy/binary-tree
- @onesy/binary-tree/esm/index.js
- @onesy/binary-tree/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@onesy/binary-tree) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
onesy Binary Tree
Binary Tree
MIT license Production ready UMD 1.9kb gzipped 100% test cov Browser and Nodejs
Very simple code Modern code Junior friendly Typescript Made with 💛
Getting started
Add
yarn add @onesy/binary-tree
Use cases
- Min/max heaps
- Huffman coding, data compression
- Machine learning, making decisions
- etc.
Use
import { OnesyBinaryTree } from '@onesy/binary-tree';
// Make a new binary tree instance
const onesyBinaryTree = new OnesyBinaryTree();
// Add a onesy node / value
[4, 2, 7, 14, 1, 3, 5].map(value => onesyBinaryTree.add(value));
// or use a make method or a static method
onesyBinaryTree.make([4, 2, 7, 14, 1, 3, 5]);
// Binary tree
4
/ \
/ \
2 7
/ \ / \
1 3 5 14
// Remove any value
onesyBinaryTree.remove(2);
// Binary tree
4
/ \
/ \
3 7
/ / \
1 5 14
Dev
Install
yarn
Test
yarn test
Prod
Build
yarn build