Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amaui-org/amaui-binary-tree
Binary tree
https://github.com/amaui-org/amaui-binary-tree
algorithm amaui binary-serach-tree binary-tree browser bst javascript js library node nodejs typescript utils web
Last synced: 11 days ago
JSON representation
Binary tree
- Host: GitHub
- URL: https://github.com/amaui-org/amaui-binary-tree
- Owner: amaui-org
- License: mit
- Created: 2022-02-13T02:50:31.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-03-29T22:26:59.000Z (8 months ago)
- Last Synced: 2024-10-07T16:36:56.102Z (about 1 month ago)
- Topics: algorithm, amaui, binary-serach-tree, binary-tree, browser, bst, javascript, js, library, node, nodejs, typescript, utils, web
- Language: TypeScript
- Homepage: https://docs.amaui.me/library/binary-tree
- Size: 49.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
amaui 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 :yellow_heart:
## Getting started
### Add
```sh
yarn add @amaui/binary-tree
```### Use cases
- Min/max heaps
- Huffman coding, data compression
- Machine learning, making decisions
- etc.### Use
```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
```### Dev
Install
```sh
yarn
```Test
```sh
yarn test
```### Prod
Build
```sh
yarn build
```