Binary tree
npm install @amaui/binary-tree
Binary Tree
Very simple code
Modern code
Junior friendly
Typescript
Made with :yellow_heart:
``sh
// yarn
yarn add @amaui/binary-tree
// npm
npm install @amaui/binary-tree
`
`javascript
import { AmauiBinaryTree } from '@amaui/binary-tree';
// Make a new binary tree instance
const amauiBinaryTree = new AmauiBinaryTree();
// Add a amaui node / value
[4, 2, 7, 14, 1, 3, 5].map(value => amauiBinaryTree.add(value));
// or use a make method or a static method
amauiBinaryTree.make([4, 2, 7, 14, 1, 3, 5]);
// Binary tree
4
/ \
/ \
2 7
/ \ / \
1 3 5 14
// Remove any value
amauiBinaryTree.remove(2);
// Binary tree
4
/ \
/ \
3 7
/ / \
1 5 14
`
Install
`sh`
yarn
Test
`sh`
yarn test
Build
`sh``
yarn build
Might be soon...