A beginner-friendly JavaScript utility package for common Data Structures and Algorithms, created by Suman Dey.
Use this package to practice and build with DSA concepts like sorting, searching, stack, queue, and linked list — all in one lightweight NPM module.
- 🔢 Bubble, Selection, Insertion, Merge Sort
- 🔍 Binary Search
- 🧮 Factorial & Fibonacci
- 📦 Stack (class-based)
- 📥 Queue (class-based)
- 🔗 Singly Linked List (insert, delete, search)
npm install js-dsa-utils
const {
bubbleSort,
selectionSort,
insertionSort,
mergeSort,
binarySearch,
factorial,
fibonacci,
Stack,
Queue,
SinglyLinkedList,
} = require("js-dsa-utils");
// Sorting
console.log(bubbleSort([5, 3, 1])); // [1, 3, 5]
// Searching
console.log(binarySearch([1, 3, 5], 3)); // 1
// Math
console.log(factorial(5)); // 120
console.log(fibonacci(6)); // 8
// Stack
const stack = new Stack();
stack.push(10);
stack.push(20);
console.log(stack.pop()); // 20
// Queue
const queue = new Queue();
queue.enqueue(1);
queue.enqueue(2);
console.log(queue.dequeue()); // 1
// Singly Linked List
const list = new SinglyLinkedList();
list.insertAtHead(10);
list.insertAtTail(20);
list.delete(10);
console.log(list.toArray()); // [20]