amaui-org / amaui-binary-tree

Binary tree

Home Page:https://docs.amaui.me/library/binary-tree

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool



amaui logo

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 đź’›


Getting started

Add

  yarn add @amaui/binary-tree

Use cases

  • Min/max heaps
  • Huffman coding, data compression
  • Machine learning, making decisions
  • etc.

Use

  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

  yarn

Test

  yarn test

Prod

Build

  yarn build

About

Binary tree

https://docs.amaui.me/library/binary-tree

License:MIT License


Languages

Language:TypeScript 59.5%Language:JavaScript 40.5%