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

@zennal/dsa

v1.0.2

Published

A comprehensive TypeScript/JavaScript npm package providing production-ready implementations of common data structures and algorithms.

Downloads

329

Readme

@zennal/dsa

A comprehensive Javascript/TypeScript npm package providing efficient implementations of data structures and algorithms for competitive programming, education, and software development.

npm version npm downloads GitHub stars Author

Installation

    npm install @zennal/dsa

Usage

    import {} from /* your imports */ "@zennal/dsa";

Algorithms

  • Combinations - combinations(arr, k)
  • Combination Sum - combinationSum(candidates, target)
  • Combination Sum (Unlimited) - combinationSumUnlimited(candidates, target)
  • Expression Add Operators - expressionAddOperators(num, target)
  • Generate Parentheses - generateParentheses(n)
  • Letter Combinations - letterCombinations(digits)
  • N-Queens - nQueens(n)
  • Palindrome Partitions - palindromePartitions(s)
  • Permutations - permutations(arr)
  • Restore IP Addresses - restoreIpAddresses(s)
  • Subsets - subsets(arr)
  • Subset Sum - subsetSum(arr, target)
  • Sudoku Solver - sudokuSolver(board)
  • Unique Permutations - uniquePermutations(arr)
  • Word Search - wordSearch(board, word)
  • Coin Change - coinChange(coins, amount)
  • Fibonacci - fibonacci(n)
  • Fibonacci (Memoization) - fibonacciMemo(n)
  • Get Coin Change Solution - getCoinChangeSolution(coins, amount)
  • Get Houses to Rob - getHousesToRob(nums)
  • Get Knapsack 0/1 Items - getKnapsack01Items(weights, values, capacity)
  • Get Longest Increasing Subsequence - getLongestIncreasingSubsequence(arr)
  • Get Matrix Chain Multiplication Order - getMatrixChainMultOrder(p)
  • Get Max Subarray - getMaxSubarray(arr)
  • Get Min Cost Path - getMinCostPath(cost)
  • Get Rod Cutting Pieces - getRodCuttingPieces(prices)
  • House Robber - houseRobber(nums)
  • Knapsack 0/1 - knapsack01(weights, values, capacity)
  • Longest Increasing Subsequence - longestIncreasingSubsequence(arr)
  • Matrix Chain Multiplication - matrixChainMultiplication(p)
  • Max Subarray Sum - maxSubarraySum(arr)
  • Min Cost Path - minCostPath(cost)
  • Minimum Steps to One - minimumStepsToOne(n)
  • Perfect Squares - perfectSquares(n)
  • Rod Cutting - rodCutting(prices)
  • Unique Paths - uniquePaths(m, n)
  • Bellman Ford - bellmanFord(n, edges, start)
  • Bipartite Matching - bipartiteMatching(n, edges)
  • Find Articulation Points - findArticulationPoints(n, edges)
  • Find Bridges - findBridges(n, edges)
  • Floyd Warshall - floydWarshall(graph)
  • Hamiltonian Path - hamiltonianPath(n, edges)
  • Has Cycle (Directed Graph) - hasCycleDirGraph(n, edges)
  • Has Cycle (Undirected Graph) - hasCycleUndirGraph(n, edges)
  • Is Eulerian - isEulerian(n, edges)
  • Kruskal's Algorithm - kruskal(n, edges)
  • Maximum Flow - maximumFlow(n, source, sink, edges)
  • Prim's Algorithm - prim(n, edges)
  • Strongly Connected Components - stronglyConnectedComponents(n, edges)
  • Topological Sort - topologicalSort(n, edges)
  • Weakly Connected Components - weaklyConnectedComponents(n, edges)
  • Activity Selection - activitySelection(activities)
  • Coin Change (Greedy) - coinChangeGreedy(coins, amount)
  • Dijkstra's Algorithm - dijkstra(n, edges, start)
  • Egyptian Fraction - egyptianFraction(numerator, denominator)
  • Fractional Knapsack - fractionalKnapsack(weights, values, capacity)
  • Graph Coloring - graphColoring(n, edges, colors)
  • Huffman Coding - huffmanCoding(frequencies)
  • Huffman Decode - huffmanDecode(encoded, huffmanTree)
  • Interval Scheduling - intervalScheduling(intervals)
  • Kruskal with Weights - kruskalWithWeights(n, edges)
  • Minimum Platforms - minimumPlatforms(arrivals, departures)
  • Prim with Weights - primWithWeights(n, edges)
  • Task Scheduling - taskScheduling(tasks)
  • Weighted Job Scheduling - weightedJobScheduling(jobs)
  • All Divisors - allDivisors(n)
  • Bell Numbers - bell(n)
  • Catalan Numbers - catalan(n)
  • Combination - combination(n, r)
  • Count Divisors - countDivisors(n)
  • Digital Root - digitalRoot(n)
  • Digit Sum - digitSum(n)
  • Extended GCD - extendedGcd(a, b)
  • Factorial - factorial(n)
  • Fibonacci Matrix - fibonacciMatrix(n)
  • GCD - gcd(a, b)
  • GCD Multiple - gcdMultiple(nums)
  • Integer Square Root - intSqrt(n)
  • Is Abundant Number - isAbundantNumber(n)
  • Is Armstrong Number - isArmstrongNumber(n)
  • Is Deficient Number - isDeficientNumber(n)
  • Is Miller-Rabin Prime - isMillerRabinPrime(n, k)
  • Is Neon Number - isNeonNumber(n)
  • Is Perfect Number - isPerfectNumber(n)
  • Is Perfect Square - isPerfectSquare(n)
  • Is Prime - isPrime(n)
  • LCM - lcm(a, b)
  • LCM Multiple - lcmMultiple(nums)
  • Modular Inverse - modInverse(a, m)
  • Modular Exponentiation - modPow(base, exp, mod)
  • Pascal's Triangle - pascalTriangle(n)
  • Permutation - permutation(n, r)
  • Power - power(base, exp)
  • Prime Factorization - primeFactorization(n)
  • Prime Factorization (Map) - primeFactorizationMap(n)
  • Segmented Sieve - segmentedSieve(left, right)
  • Sieve of Eratosthenes - sieveOfEratosthenes(n)
  • Stirling Numbers - stirling(n, k)
  • Sum of Divisors - sumOfDivisors(n)
  • Binary Search - binarySearch(array, target, compareFn)
  • Binary Search (Recursive) - binarySearchRecursive(array, target, compareFn)
  • Exponential Search - exponentialSearch(array, target, compareFn)
  • Fibonacci Search - fibonacciSearch(array, target, compareFn)
  • Find First - findFirst(array, target, compareFn)
  • Find Insert Position - findInsertPosition(array, target, compareFn)
  • Find Last - findLast(array, target, compareFn)
  • Interpolation Search - interpolationSearch(array, target)
  • Jump Search - jumpSearch(array, target, compareFn)
  • Linear Search - linearSearch(array, target, compareFn)
  • Linear Search All - linearSearchAll(array, target, compareFn)
  • Sentinel Linear Search - sentinelLinearSearch(array, target, compareFn)
  • Ternary Search - ternarySearch(array, target, compareFn)
  • Bubble Sort - bubbleSort(array, compareFn)
  • Heap Sort - heapSort(array, compareFn)
  • Insertion Sort - insertionSort(array, compareFn)
  • Merge Sort - mergeSort(array, compareFn)
  • Quick Sort - quickSort(array, compareFn)
  • Selection Sort - selectionSort(array, compareFn)
  • Boyer-Moore - boyerMoore(text, pattern)
  • Count Occurrences - countOccurrences(text, pattern)
  • Edit Distance - editDistance(s1, s2)
  • Get All Unique Substrings - getAllUniqueSubstrings(s)
  • Get Edit Operations - getEditOperations(s1, s2)
  • Get Longest Common Subsequence - getLongestCommonSubsequence(s1, s2)
  • Has Unique Characters - hasUniqueCharacters(s)
  • Is Palindrome - isPalindrome(s)
  • Is Rotation - isRotation(s1, s2)
  • KMP Search - kmpSearch(text, pattern)
  • Longest Common Subsequence - longestCommonSubsequence(s1, s2)
  • Longest Palindrome - longestPalindrome(s)
  • Longest Palindrome (Expand) - longestPalindromeExpand(s)
  • Rabin-Karp - rabinKarp(text, pattern)
  • Reverse Words - reverseWords(s)

Data Structures

  • Array Deque - new ArrayDeque() - FIFO/LIFO double-ended queue with array-backed storage
  • Circular Buffer - new CircularBuffer(capacity) - Fixed-size ring buffer for efficient memory usage
  • Gap Buffer - new GapBuffer() - Two-sided buffer optimized for text editing operations
  • Graph - new Graph(directed) - Adjacency list-based graph supporting directed/undirected edges
  • Bloom Filter - new BloomFilter(size, hashFunctions) - Probabilistic data structure for set membership testing
  • HashMap - new HashMap(keyHashFn, initialCapacity) - Hash table with separate chaining collision resolution
  • LRU Cache - new LRUCache(capacity) - Least Recently Used cache with O(1) operations
  • Cuckoo HashMap - new CuckooHashMap() - Hash map with cuckoo hashing for collision resolution
  • Robin Hood HashMap - new RobinHoodHashMap() - Hash map with Robin Hood hashing for better distribution
  • Heap - new Heap(compareFn, type) - Min/max heap implementation
  • ArrayList - new ArrayList() - Resizable array-based list with dynamic capacity
  • Deque - new Deque() - Double-ended queue (FIFO/LIFO operations from both ends)
  • Linked List - new LinkedList() - Singly linked list with sequential access
  • Priority Queue - new PriorityQueue(compareFn) - Queue with priority-based ordering
  • Queue - new Queue() - FIFO queue data structure
  • Stack - new Stack() - LIFO stack data structure
  • Disjoint Set (Union-Find) - new DisjointSet(n) - Data structure for managing disjoint sets with union and find operations
  • Count-Min Sketch - new CountMinSketch(width, depth) - Probabilistic data structure for frequency estimation
  • Quotient Filter - new QuotientFilter(size, quotientBits) - Space-efficient hash filter
  • XOR Filter - new XorFilter() - Fast and compact filter for set membership
  • Binary Lifting - new BinaryLifting(n, edges) - LCA and path query optimization
  • Cartesian Tree - new CartesianTree(arr) - Tree with range minimum query capabilities
  • Square Root Tree - new SqrtTree(arr) - Structure for fast range queries
  • AVL Tree - new AVLTree(compareFn) - Self-balancing binary search tree with height constraints
  • Binary Search Tree - new BinarySearchTree(compareFn) - Ordered tree for efficient searching
  • Fenwick Tree (Binary Indexed Tree) - new FenwickTree(n) - Data structure for prefix sum and range update queries
  • Red-Black Tree - new RedBlackTree(compareFn) - Self-balancing binary search tree with color properties
  • Segment Tree - new SegmentTree(arr, operation) - Tree for range queries and updates
  • Trie - new Trie() - Prefix tree for efficient string searching and storage

Contributing

We welcome contributions! Whether it's fixing bugs, adding new algorithms, improving documentation, or suggesting features, your input is valuable. Please check out our contributing guidelines and feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ for the developer community. Happy coding!