javascript-algorithms
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
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.
N-Queens Problem Backtracking Approach in JavaScript: A Complete Implementation GuideLearn 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 the Recursive Staircase Solution Uses Dynamic Programming MemoizationLearn 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.
How to Implement Bitwise Operations for Math Algorithms in JavaScriptMaster 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.
KMP vs Z-Algorithm vs Rabin-Karp: Comparing String Matching Algorithms in JavaScriptExplore KMP vs Z-Algorithm vs Rabin-Karp string matching in JavaScript. Discover their preprocessing, space needs, and performance for efficient substring search.
Strongly Connected Components (Kosaraju's Algorithm) Implementation in JavaScriptDiscover the JavaScript implementation of Kosaraju's algorithm for finding strongly connected components. Learn how two DFS passes and graph reversal achieve this decomposition.
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.
BFS vs DFS Graph Traversal: Key Differences and When to Use EachUnderstand 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.
How the k-Means Clustering Algorithm Handles Centroid InitializationDiscover how k-Means clustering algorithm selects initial centroids using the first k data points. Learn about effective centroid initialization in this article.
How the Seam Carving Image Resizing Algorithm Is Implemented in trekhleb/javascript-algorithmsExplore the Seam Carving algorithm implementation in javascript-algorithms. Learn content-aware image resizing via energy maps, seam selection, and removal.
How Kruskal's and Prim's Algorithms Differ for MST: A Code-Based ComparisonCompare 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.
How Disjoint Set (Union-Find) Path Compression Works in JavaScript AlgorithmsLearn how Disjoint Set path compression optimizes Union-Find algorithms. Understand the technique and its JavaScript implementation details.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →