avl-trees-js
A module to perform all the avl tree implementations.Just test it to see
Last updated 5 months ago by samuelmayna .
MIT · Original npm · Tarball · package.json
$ cnpm install avl-trees-js 
SYNC missed versions from official npm registry.

avl-trees-js is a light package that allows you to perform all the avl tree operations efficiently

Installation

$ npm install avl-trees-js 

Importing

// Using Node.js `require()`
const avl= require('avl-trees-js ');

// Using ES6 imports
import avl from 'avl-trees-js ';

###Insertion

avl.insert(value);

###Traversing you can traverse in: inOrder,postOrder and PreOrder

avl.traverse('orderToTraverse',cb());

e.g

avl.traverse('postOrder',cb());

by default you traverse in order i.e

avl.traverse(cb());

###Getting Maximum and Minimum

avl.Max() 

returns the node with the maximum value. To get the value just add getData() to the retrieved node. note: .getData() retrieves the stored value in a node i.e

avl.Max().getData()

same applies to min except we use Min() in place of Max()

###deleting nodes from the tree

avl.remove(nodeValue)

removes the node with the value and rebalances the tree

###finding the node with the a given value

avl.find(nodeValue)

returns null incase no node with that value exists

###Testing

npm test

Current Tags

  • 1.2.3                                ...           latest (5 months ago)

5 Versions

  • 1.2.3                                ...           5 months ago
  • 1.2.2                                ...           5 months ago
  • 1.2.1                                ...           5 months ago
  • 1.2.0                                ...           5 months ago
  • 1.0.0                                ...           5 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |