workflowstacks
ai-agent

Javascript Algorithms

Algorithms and data structures implemented in JavaScript with explanations and links to further readings
196,469 stars31,046 forksJavaScriptUpdated 7/26/2026100% free · open source
What it does

javascript-algorithms provides a collection of JavaScript implementations of various algorithms and data structures, along with explanations and links to further learning resources

Install / run
git clone https://github.com/trekhleb/javascript-algorithms.git
When to use it
  • When you need to implement a specific algorithm or data structure in a JavaScript project
  • When you want to learn about different algorithms and data structures and how they can be applied in JavaScript
  • When you need a reference implementation of an algorithm or data structure for testing or comparison purposes
Quick start
  1. 1Explore the README.md file to get an overview of the available algorithms and data structures
  2. 2Open the src directory to find the implementation of a specific algorithm, such as src/algorithms/searching/linear-search.js
  3. 3Run a specific algorithm using Node.js, for example: node src/algorithms/searching/linear-search.js
  4. 4Check out the docs directory for more detailed documentation and explanations of the algorithms and data structures
  5. 5Use the provided test cases in the test directory to verify the correctness of the implementations
Ready-to-paste prompt
node src/algorithms/sorting/quick-sort.js --array=[3,6,1,8,2,4] --verbose
Heads up: Make sure you have Node.js installed on your system, as the algorithms are implemented in JavaScript and require a JavaScript runtime environment to run
Saves to your device

Topics

algorithm
algorithms
computer-science
data-structures
interview
interview-preparation
javascript
javascript-algorithms
How Javascript Algorithms works
Codeflow
Free to inspect

Javascript Algorithms is a large JavaScript project (~19k lines across 361 code files). It is a full software project: use it through its install path rather than reading it end to end. Last commit a month ago, MIT license, has a test suite.

Size
Large codebase
~19k lines · 361 code files · ~3 h to skim
Setup
Developer setup
A real software project. Use it via its install path; don't expect to read it all.
Runs on
Node.js
No API keys detected
JavaScript 100%
Where to start reading
  1. 1
    README.md
    Start here — what it does and how to install it
  2. 2
    package.json
    Dependencies and the commands it exposes
  3. 3
    src/playground/README.md
    Inside src/ — the main logic begins here
What's in each folder
src/Core code — the actual logic644 files
.github/CI / automation (GitHub Actions)1 files
.husky/Folder1 files
assets/Images & static assets1 files
READMEHas testsDocumentedCI checksMIT licenseUpdated this month
Quick Actions
Details
Creator
trekhleb
Language
JavaScript
Category
ai-agent
Published
3/24/2018

Are you the creator of this tool? Claim your listing → and earn 85% of every sale.