js-data-structures
js-data-structures
npm i js-data-structures
js-data-structures

js-data-structures

A collection of data structures written in JavaScript

by gwtw

1.1.2 (see all)License:MITTypeScript:Not Found
npm i js-data-structures
Readme

js-data-structures

Build Status

A collection of data structures written in JavaScript.

Detailed information on the complexity of each data structure is located here. To learn more about how some of the data structures are implemented, check out the technical articles on Growing with the Web.

Installing

npm install --save js-data-structures

Including

var AvlTree = require('js-data-structures').AvlTree;
var BinaryHeap = require('js-data-structures').BinaryHeap;
var BinarySearchTree = require('js-data-structures').BinarySearchTree;
var BinomialHeap = require('js-data-structures').BinomialHeap;
var FibonacciHeap = require('js-data-structures').FibonacciHeap;
var RedBlackTree = require('js-data-structures').RedBlackTree;
var SplayTree = require('js-data-structures').SplayTree;

Usage

See the source files and dependencies in package.json for a list of public interfaces on each data structure, here is an example for the Fibonacci heap.

var heap = new FibonacciHeap();
heap.insert(3);
heap.insert(7);
heap.insert(8);
heap.insert(1);
heap.insert(2);

while (!heap.isEmpty()) {
  console.log(heap.extractMinimum());
}

Contributing

I'd love to get some contributions for other data structures, if you want to make a pull request try to follow the existing style of the code and make sure you add tests for the new data structure.

Testing locally

npm install
npm test

# generate coverage report in ./coverage/
grunt coverage

License

MIT © Daniel Imms

See also

Downloads/wk

14

GitHub Stars

76

LAST COMMIT

5yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

4

OPEN PRs

0
VersionTagPublished
1.1.2
latest
6yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate