Package Exports
- avl-trees-js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (avl-trees-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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