JSPM

  • Created
  • Published
  • Downloads 8250
  • Score
    100M100P100Q124065F
  • License MIT

authentic and production-ready data structures implementation in javascript.

Package Exports

  • datastructures-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 (datastructures-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

datastructures-js

build:? npm npm npm

consolidates all data structures of https://github.com/datastructures-js into a single repository.

Table of Contents

install

npm install --save datastructures-js

API

require

// import your required classes
const {
  Queue,
  PriorityQueue,
  Stack,
  Set: EnhancedSet, // you can rename it to avoid conflict with es6 Set
  LinkedList,
  DoublyLinkedList,
  MinHeap,
  MaxHeap,
  Graph,
  DirectedGraph,
  BinarySearchTree,
  AvlTree,
  Trie
} = require('datastructures-js');

import

// import your required classes
import {
  Queue,
  PriorityQueue,
  Stack,
  Set as EnhancedSet, // you can rename it to avoid conflict with es6 Set
  LinkedList,
  DoublyLinkedList,
  MinHeap,
  MaxHeap,
  Graph,
  DirectedGraph,
  BinarySearchTree,
  AvlTree,
  Trie
} from 'datastructures-js';

extend

There are sometimes domain-specific use cases for data structures that require either a tweak or additional functionality. Data structures are implemented as a base general purpose classes in ES6. You can always extend any of these classes to override or enhance the functionality in your own code.

Example

const { Graph } = require('datastructures-js');

class BusStationsGraph extends Graph {
  findShortestPath(srcStationId, destStationId) {
    // benefit from Graph to implement your own code 
  }
}

Data Structures

Queue

https://github.com/datastructures-js/queue

Priority Queue

https://github.com/datastructures-js/priority-queue

Stack

https://github.com/datastructures-js/stack

Set

https://github.com/datastructures-js/set

Linked List

https://github.com/datastructures-js/linked-list

Doubly Linked List

https://github.com/datastructures-js/linked-list

Min Heap

https://github.com/datastructures-js/heap

Max Heap

https://github.com/datastructures-js/heap

Graph

https://github.com/datastructures-js/graph

Directed Graph

https://github.com/datastructures-js/graph

Binary Search Tree

https://github.com/datastructures-js/binary-search-tree

AVL Tree

https://github.com/datastructures-js/binary-search-tree

Trie

https://github.com/datastructures-js/trie

Build

grunt build

License

The MIT License. Full License is here