@amaui/binary-tree
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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
  yarn add @amaui/binary-tree

  // npm
  npm install @amaui/binary-tree

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

Docs

Might be soon...

Package Sidebar

Install

npm i @amaui/binary-tree

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

37.5 kB

Total Files

11

Last publish

Collaborators

  • lazareric