npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

dsa-master

v1.0.2

Published

A comprehensive data structures and algorithms library for JavaScript, featuring optimized implementations of common DS and algorithms.

Downloads

5

Readme

DSA-Algorithms-JS

A Comprehensive Data Structures and Algorithms Library for JavaScript

Introduction

DSA-Algorithms-JS is a JavaScript library that provides efficient implementations of sorting algorithms, searching algorithms, and graph data structures. Whether you're a beginner learning DSA or an experienced developer working on competitive programming, this package will help you write optimized and well-structured code. It is designed for:

  • Sorting and Searching Algorithms
  • Dynamic Array
  • Linked List
  • Stack
  • Queue
  • Heap

Installation

  • To use this library, first install it using npm:

    npm install dsa-master
  • Then, require the necessary modules in your JavaScript file:

    const dsa = require('dsa-master');
    const { SearchingAlgorithm, SortingAlgorithm, DataStructure } = dsa;

📚 Usage

Sorting Algorithms

This table provides the time and space complexities of common sorting algorithms.

| Algorithm | Best Case | Worst Case | Average Case | Space Complexity | | ------------------ | ---------- | ---------- | ------------ | ---------------- | | Bubble Sort | O(n) | O(n²) | O(n²) | O(1) | | Selection Sort | O(n²) | O(n²) | O(n²) | O(1) | | Insertion Sort | O(n) | O(n²) | O(n²) | O(1) | | Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) | | Quick Sort | O(n log n) | O(n²) | O(n log n) | O(log n) |

const arr1 = [6, 7, -1, 0, 100, 7];
SortingAlgorithm.BubbleSort(arr1);
console.log(arr1); // Output: [-1, 0, 6, 7, 7, 100]

Searching Algorithms

| Algorithm | Best Case | Worst Case | Average Case | | ----------------- | --------- | ---------- | ------------ | | Linear Search | O(1) | O(n) | O(n) | | Binary Search | O(1) | O(log n) | O(log n) |

const arr2 = [-1, 0, 6, 7, 9, 100];
const index = SearchingAlgorithm.BinarySearch(arr2, 7);
console.log(index); // Output: 3

Dynamic Array

const DynamicArray = DataStructure.Array;
const array = new DynamicArray();
array.push(10);
array.push(20);
array.display(); // [10, 20]
array.pop();
array.display(); // [10]

Linked List

const LinkedList = DataStructure.LinkedList;
const list = new LinkedList();
list.append(5);
list.append(10);
list.display(); // 5 -> 10 -> null
list.delete(5);
list.display(); // 10 -> null

Stack

const Stack = DataStructure.Stack;
const stack = new Stack();
stack.push(5);
stack.push(10);
stack.display(); // [5, 10]
stack.pop();
stack.display(); // [5]

Queue

const Queue = DataStructure.Queue;
const queue = new Queue();
queue.enqueue(5);
queue.enqueue(10);
queue.display(); // [5, 10]
queue.dequeue();
queue.display(); // [10]

Heap

const Heap = DataStructure.PriorityQueue;
const minHeap = new Heap((a, b) => a < b); // Min Heap
minHeap.insert(10);
minHeap.insert(5);
minHeap.display(); // [5, 10]
minHeap.remove();
minHeap.display(); // [10]

Graph (Adjacency List Representation)

const Graph = dsa.Graph;
const graph = new Graph();
graph.addVertex('A');
graph.addVertex('B');
graph.addEdge('A', 'B');
graph.display();
// A : [ 'B' ]
// B : [ 'A' ]

📞 Contact

Feel free to reach out: