Socket
Socket
Sign inDemoInstall

dstructures.js

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dstructures.js

Data structures and algorithms written in JavaScript


Version published
Weekly downloads
5
Maintainers
1
Install size
180 kB
Created
Weekly downloads
 

Readme

Source

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
  • Algorithms
  • Installation
  • Getting Started

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
  }
}

Keywords

FAQs

Last updated on 24 Aug 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc