javascript-algorithms

📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings

23 articles 196k View on GitHub ↗
23 articles
Hill Cipher and Caesar Cipher Implementation in JavaScript

Discover JavaScript implementations of Hill Cipher and Caesar Cipher. Learn how these cryptographic algorithms use modular arithmetic and matrix multiplication for encryption in this clear guide.

deep-dive
Feb 24, 2026
N-Queens Problem Backtracking Approach in JavaScript: A Complete Implementation Guide

Learn the N-Queens problem backtracking approach in JavaScript. This guide details the recursive algorithm, safe queen placement, and conflict resolution for finding all solutions.

how-to-guide
Feb 24, 2026
How the Recursive Staircase Solution Uses Dynamic Programming Memoization

Learn how the recursive staircase dynamic programming solution employs memoization to optimize performance. Slash complexity from O(2ⁿ) to O(n) by solving subproblems just once.

deep-dive
Feb 24, 2026
How to Implement Bitwise Operations for Math Algorithms in JavaScript

Master bitwise operations in JavaScript for math algorithms. Learn to use core operators like & ^ and >>> to manipulate 32-bit integers effectively. Explore the trekhleb javascript-algorithms repo.

how-to-guide
Feb 24, 2026
KMP vs Z-Algorithm vs Rabin-Karp: Comparing String Matching Algorithms in JavaScript

Explore KMP vs Z-Algorithm vs Rabin-Karp string matching in JavaScript. Discover their preprocessing, space needs, and performance for efficient substring search.

comparison
Feb 24, 2026
Strongly Connected Components (Kosaraju's Algorithm) Implementation in JavaScript

Discover the JavaScript implementation of Kosaraju's algorithm for finding strongly connected components. Learn how two DFS passes and graph reversal achieve this decomposition.

how-to-guide
Feb 24, 2026
How Does the Topological Sorting Algorithm Detect Cycles in Directed Graphs?

Discover how the topological sort in javascript-algorithms handles directed graphs, noting its cycle detection limitations and how it avoids infinite recursion.

deep-dive
Feb 24, 2026
BFS vs DFS Graph Traversal: Key Differences and When to Use Each

Understand BFS vs DFS graph traversal. Learn how BFS finds shortest paths with a queue and DFS explores deeply with recursion for cycle detection and topological sorting.

deep-dive
Feb 24, 2026
How the k-Means Clustering Algorithm Handles Centroid Initialization

Discover how k-Means clustering algorithm selects initial centroids using the first k data points. Learn about effective centroid initialization in this article.

deep-dive
Feb 24, 2026
How the Seam Carving Image Resizing Algorithm Is Implemented in trekhleb/javascript-algorithms

Explore the Seam Carving algorithm implementation in javascript-algorithms. Learn content-aware image resizing via energy maps, seam selection, and removal.

how-to-guide
Feb 24, 2026
How Kruskal's and Prim's Algorithms Differ for MST: A Code-Based Comparison

Compare Kruskal's and Prim's MST algorithms side-by-side. Understand their code-based differences in edge sorting, cycle avoidance, and time complexity for finding minimum spanning trees.

deep-dive
Feb 24, 2026
How Disjoint Set (Union-Find) Path Compression Works in JavaScript Algorithms

Learn how Disjoint Set path compression optimizes Union-Find algorithms. Understand the technique and its JavaScript implementation details.

deep-dive
Feb 24, 2026

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →