dstructures.js

1.0.5 • Public • Published

DStructures.js

Welcome to DStructures.js! This package provides implementations of various data structures and algorithms in JavaScript. Navigate through specific directories to get a deeper understanding of each component.

Table of Contents

Data Structures

(Note: For specific details on each data structure, click on the respective link.)

Algorithms

(Note: For specific details on each algorithm, click on the respective link.)

Installation

To utilize these data structures and algorithms in your projects:

npm install --save dstructures.js

Getting Started

Here's a simple example to get started with the Linked List data structure:

const { LinkedList } = require('DStructures.js');

const list = new LinkedList();
list.addLast(1);
list.addLast(2);
list.addLast(3);

console.log(list.toArray());  // Outputs: [1, 2, 3]

For more detailed usage and API descriptions, please refer to the individual READMEs of each data structure or algorithm.

Require

const {
  BinarySearchTree, BinarySearchTreeNode,
  DoublyLinkedList, DoublyLinkedListNode,
  Graph, GraphVertex,
  HashMap,
  HashSet,
  Heap, MinHeap, MaxHeap,
  LinkedList, LinkedListNode,
  PriorityQueue, PriorityQueueNode,
  Queue,
  Stack,
  binarySearch,
  bubbleSort,
  dijkstra,
  insertionSort,
  mergeSort,
  quickSort,
  selectionSort,
} = require('dstructures.js');

Import

import {
  BinarySearchTree, BinarySearchTreeNode,
  DoublyLinkedList, DoublyLinkedListNode,
  Graph, GraphVertex,
  HashMap,
  HashSet,
  Heap, MinHeap, MaxHeap,
  LinkedList, LinkedListNode,
  PriorityQueue, PriorityQueueNode,
  Queue,
  Stack,
  binarySearch,
  bubbleSort,
  dijkstra,
  insertionSort,
  mergeSort,
  quickSort,
  selectionSort,
} from 'dstructures.js';

Extend

Data structures are implemented as ES6 classes and can be extended for additional functionality.

const { Graph } = require('dstructures.js');

class CustomGraph extends Graph {
  shortestPath(start, end) {
    // code here
  }
}

Package Sidebar

Install

npm i dstructures.js

Weekly Downloads

4

Version

1.0.5

License

ISC

Unpacked Size

184 kB

Total Files

63

Last publish

Collaborators

  • tshields86