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

@tzm96dev/algo-toolkit

v1.0.0

Published

Algorithms Kit: A TypeScript-first library of classic and modern algorithms. Includes sorting, searching, and string-matching utilities for arrays, numbers, and objects. Lightweight, fast, and production-ready.

Readme

@tzm96dev/algo-toolkit

Ultimate Sorting & Searching Toolkit for numbers, strings, and objects.

Features

  • 🔢 Works with numbers, strings, and objects (via key or accessor)
  • ⚡ Optimized algorithms (Quick, Merge, Heap, Radix, KMP, etc.)
  • 🔄 Stable sorts where applicable
  • 📦 TypeScript + JavaScript compatible
  • 🧩 Real-world examples for each algorithm

📥 Installation

1. Install via npm

npm install @tzm96dev/algo-toolkit

2. Install via yarn

yarn add @tzm96dev/algo-toolkit

3. Install via pnpm

pnpm add @tzm96dev/algo-toolkit

🚀 Usage Examples

JavaScript

const {
  mergeSort,
  binarySearch,
  kmpSearch,
} = require("@tzm96dev/algo-toolkit");

console.log(mergeSort([5, 2, 9, 1])); // [1,2,5,9]
console.log(binarySearch([1, 2, 5, 9], 9)); // 3
console.log(kmpSearch("hello world", "world")); // 6

TypeScript

import { mergeSort, binarySearch, kmpSearch } from "@tzm96dev/algo-toolkit";

console.log(mergeSort([5, 2, 9, 1]));
console.log(binarySearch([1, 2, 5, 9], 9));
console.log(kmpSearch("hello world", "world"));

📚 Sorting Algorithms

| Algorithm | Best | Average | Worst | Stable | Use Case | | -------------- | -------- | -------- | -------- | ------ | ---------------------------- | | Bubble Sort | O(n) | O(n²) | O(n²) | ✅ Yes | Teaching basics | | Insertion Sort | O(n) | O(n²) | O(n²) | ✅ Yes | Small/nearly sorted arrays | | Selection Sort | O(n²) | O(n²) | O(n²) | ❌ No | Educational | | Merge Sort | O(nlogn) | O(nlogn) | O(nlogn) | ✅ Yes | Stable sorting | | Quick Sort | O(nlogn) | O(nlogn) | O(n²) | ❌ No | Fastest general case | | Heap Sort | O(nlogn) | O(nlogn) | O(nlogn) | ❌ No | Memory efficient | | Counting Sort | O(n+k) | O(n+k) | O(n+k) | ✅ Yes | Small integer range | | Radix Sort | O(nk) | O(nk) | O(nk) | ✅ Yes | Integers (handles negatives) | | Bucket Sort | O(n+k) | O(n+k) | O(n²) | ❌ No | Uniform floats / known range |


🔍 Searching Algorithms

| Algorithm | Time Complexity | Notes | | ------------------ | ----------------- | ------------------------------ | | Linear Search | O(n) | Works on unsorted arrays | | Binary Search | O(log n) | Requires sorted array | | Jump Search | O(√n) | Faster linear on sorted | | Interpolation | O(log log n) best | Uniform distribution (numbers) | | Exponential Search | O(log n) | Unknown length / large arrays | | Ternary Search | O(log₃ n) | Optimization problems | | Fibonacci Search | O(log n) | Sorted numeric arrays | | Hash Search | O(1) avg | Fast lookups with Map | | KMP Search | O(n+m) | Substring search | | Rabin-Karp Search | O(n+m) avg | Substring (rolling hash) |


🧩 Real-World Usage

import {
  countingSort,
  radixSort,
  bucketSort,
  fibonacciSearch,
  hashSearch,
  kmpSearch,
} from "@tzm96dev/algo-toolkit";

console.log(countingSort([18, 21, 19, 18, 20, 19]));
console.log(radixSort([9876543210, 1234567890, 5555555555]));
console.log(bucketSort([0.78, 0.12, 0.56, 0.89, 0.45]));

console.log(fibonacciSearch([10, 20, 30, 40, 50], 30)); // 2
console.log(
  hashSearch(
    [
      { id: 1, name: "A" },
      { id: 2, name: "B" },
    ],
    2,
    { key: "id" }
  )
); // 1
console.log(kmpSearch("The quick brown fox", "brown")); // 10

🤝 Contributing

We ❤️ contributions!

  1. Fork this repo:
    git clone https://github.com/Talha-Zubair-Mayo/algo-toolkit.git
    cd algo-toolkit
  2. Create a branch:
    git checkout -b feature/my-feature
  3. Make your changes, commit & push:
    git commit -m "Added new algorithm"
    git push origin feature/my-feature
  4. Open a Pull Request 🎉

📜 License

MIT