Napoleonic Political Magnificence
    Have ideas to improve npm?Join in the discussion! »

    datastructures-js

    9.0.0 • Public • Published

    build:? npm npm npm

    consolidates all data structures of @datastructures-js into a single repository. Data structures are distributed into their own repositories for easier maintenance and usability so that they can be installed and imported individually in the code.

    Table of Contents

    install

    npm install --save datastructures-js

    API

    require

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

    import

    // import your required classes
    import {
      Queue,
      PriorityQueue,
      Stack,
      Set as EnhancedSet, // renamed to avoid conflict with es6 Set
      LinkedList,
      DoublyLinkedList,
      MinHeap,
      MaxHeap,
      MinPriorityQueue,
      MaxPriorityQueue,
      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 here are implemented as a base general purpose classes in ES6. You can always use any of these classes to override or extend the functionality in your own code.

    Example

    const { Graph } = require('datastructures-js'); // OR require('@datastructures-js/graph')
    
    class BusStationsGraph extends Graph {
      findShortestPath(srcStationId, destStationId) {
        // benefit from Graph to implement your own code 
      }
    }

    Data Structures

    Queue

    https://github.com/datastructures-js/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

    Min Priority Queue

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

    Max Priority Queue

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

    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

    Install

    npm i datastructures-js

    DownloadsWeekly Downloads

    236

    Version

    9.0.0

    License

    MIT

    Unpacked Size

    9.2 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar