ds-js-x
v1.0.15
Published
JavaScript Data Structure by Johnson Han
Downloads
8
Maintainers
Readme
ds-js-x
JavaScript Data Structure Library for leetcoding or general use. Currently supports:
- LinkedList
- Stack
- Queue
- Binary Search Tree
- Heap (Min & Max)
- Priority Queue
- Disjoint Set
- Segment Tree
Installation
npm i --save ds-js-x
Documentation
Usage
- Imports all data structure:
+ let DS = require('ds-js-x');
+ DS.help();
-Imports BinarySearchTree:
+ let tree = new DS.BinarySearchTree();
-Imports LinkedList:
+ let list = new DS.LinkedList();
- Imports Stack:
+ let stack = new DS.Stack();
- Imports Queue:
+ let queue = new DS.Queue();
- Imports Max Heap:
+ let heap = new DS.PriorityQueue();
- Imports Min Heap:
+ let heap = new DS.PriorityQueue((a, b) => a - b < 0);
- Imports Priority Queue:
+ let queue = new DS.PriorityQueue(comparator);
Development
src
folder contains the implementation detailsnpm run build
to produce build/ foldernpm run test
to run all testcases
build
folder contains the version to be publishedtest
folder contains integration testing code- Download the latest version of ds-js-x
- Use this package as if you are the actual user