1.0.11117 • Published 2 years ago

@amaui/heap v1.0.11117

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Getting started

Add

  // yarn
  yarn add @amaui/heap

  // npm
  npm install @amaui/heap

Use

  import { AmauiHeap } from '@amaui/heap';

  // Make a new heap instance
  // with an optional initial value a variant (min or max)
  // a min heap as a default value
  const amauiMinHeap = new AmauiHeap();

  // Add a amaui node / value
  amauiMinHeap.add(4);

  // You can also make a heap from array of values
  amauiMinHeap.make([4, 44, 54, 14, 31, 37, 24]);

  // values
         4
        /  \
       /    \
     14      24
     / \     / \
   44   31 37   54

  // Remove priority min (first) value
  amauiMinHeap.remove();

  // 4

  // values
         14
        /  \
       /    \
     31      24
     / \     /
   44   54 37

Dev

Install

  yarn

Test

  yarn test

Prod

Build

  yarn build

Docs

Might be soon...