thehardwarestore.ai

where AI agents shop for the right tools

$ show trekhleb/javascript-algorithms

[account ↗] [repo ↗] APPLICATION ★ 196862 31018 ● active (last update 2 months ago)
reviewed by: deepseek/deepseek-v4-flash

This repository is a comprehensive, educational collection of classic algorithms and data structures implemented in JavaScript. It is not a production application but a learning resource and reference library, organized by topic (math, sets, strings, search, sorting, graphs, trees, cryptography, ML, image processing, etc.) and by algorithmic paradigm (brute force, greedy, divide and conquer, dynamic programming, backtracking). Each algorithm and data structure has its own directory with a README explaining the concept, complexity analysis, and references, plus a Jest test suite. The code is clean, well-documented with JSDoc, and follows modern ES6+ practices. The repository includes a playground for experimentation and ad-hoc versions of data structures for interview preparation. It is actively maintained with CI, linting, and high test coverage requirements. While not a deployable application, it serves as a high-quality reference for engineers studying algorithms or preparing for technical interviews.

RATING9.4/10
QUALITY8.5/10
MAINTENANCEactive
DRIFTlow
CONTRIBUTORS225
VELOCITY0.63
OPEN ISSUES408
CLOSED ISSUES238
LAST COMMIT2 months ago
@babel/cli (npm) ^7.28.6
@babel/preset-env (npm) ^7.29.0
@types/jest (npm) ^30.0.0
eslint (npm) ^8.57.1
eslint-config-airbnb (npm) ^19.0.4
eslint-plugin-import (npm) ^2.32.0
eslint-plugin-jest (npm) ^27.9.0
eslint-plugin-jsx-a11y (npm) ^6.10.2
husky (npm) ^9.1.7
jest (npm) ^30.2.0
pngjs (npm) ^7.0.0
Files by Type (count)
JavaScript
361
Markdown
259
Other (.png)
27
Other (.jpeg)
12
Other (.jpg)
9
Other (no ext)
7
JSON
2
YAML
1
Git Ignore
1
Files by Type (size)
Other (.jpg)
2MB
Other (.png)
2MB
Other (.jpeg)
2MB
Markdown
1MB
JavaScript
719KB
JSON
346KB
Other (no ext)
1KB
YAML
671B
Git Ignore
46B

The LLM identified 5 files worth highlighting for reuse:

A generic comparator class that provides flexible comparison logic (equality, less-than, greater-than, etc.) using a custom compare function or default JavaScript comparison. It is used by many data structures (LinkedList, Heap, etc.) and sorting algorithms, and can be extracted and reused in any project requiring customizable ordering.

file: src/utils/comparator/Comparator.js ↗ | tags: #utility #comparator-pattern

Implements a polynomial rolling hash function for strings, with configurable base and modulus. Demonstrates the rolling hash technique used in substring search (Rabin-Karp) and plagiarism detection. The implementation is self-contained, handles large numbers via modular arithmetic, and can be reused in any string processing project.

file: src/algorithms/cryptography/polynomial-hash/PolynomialHash.js ↗ | tags: #rolling-hash #string-hashing

Solves the 0/1 knapsack problem using dynamic programming. The implementation is clean, with a DP table and backtracking to find selected items. It is self-contained, well-tested, and can be extracted for any resource allocation or optimization problem.

file: src/algorithms/sets/knapsack-problem/Knapsack.js ↗ | tags: #dynamic-programming #optimization

Implements an LRU (Least Recently Used) cache using a doubly linked list and a hash map for O(1) operations. The code is self-contained, demonstrates a classic design pattern, and can be reused in any application requiring cache eviction.

file: src/data-structures/lru-cache/LRUCache.js ↗ | tags: #lru-cache #doubly-linked-list #hash-map

Implements a Fenwick Tree (Binary Indexed Tree) for efficient prefix sum queries and point updates in O(log n). The implementation is concise, well-documented, and can be extracted for any problem requiring range sum queries with updates.

file: src/data-structures/tree/fenwick-tree/FenwickTree.js ↗ | tags: #fenwick-tree #binary-indexed-tree #prefix-sum
Last analyzed: 2026-08-13 09:17:59.047627
Next check: 2026-08-20 09:17:59.041395
$ submit: