
javascript-algorithms
JavaScript examples of many classic algorithms and data structures, with explanations and reading links.
- Stars
- 197k
- Forks
- 31k
- Licence
- MIT
- Language
- JavaScript
- Last update
- 3 months ago
- Type
- Learning resource
What it is
This repository is a collection of JavaScript implementations of well-known algorithms and data structures, such as linked lists, stacks, queues, trees, graphs, sorting and searching. Each topic has its own README with explanations and links for further reading, some including YouTube videos. It is mainly a study resource for learning how these building blocks work.
- Browse the data structures section and read the explanation for a topic such as a heap or LRU cache
- Study how a sorting algorithm such as Quicksort or Merge Sort is implemented in JavaScript
- Use the Beginner and Advanced labels to pick topics in order of difficulty
- Follow the linked reading and video resources for a topic you want to go deeper on
Great for
- Students learning core computer science concepts in JavaScript
- Developers preparing for technical interviews
- Programmers who want readable reference implementations of common algorithms
- Anyone comparing trade-offs between data structures
Not ideal for
- Developers who need a production-ready library to import, since the README presents these as educational examples
- Readers who want a single introductory course, because the material is organized as a reference index rather than a guided curriculum
How to get it
- 1
Clone and build from source
You'll need: Git
Clone the repository
git clone https://github.com/trekhleb/javascript-algorithms.git - 2
Run it
- Clone the repository to your computer
- Open the README and browse the Data Structures or Algorithms sections
- Open the linked folder for a topic you want to study
- Read the topic's README and explore the JavaScript source code
- 3
Get the most out of it
- Read the topic README first, then the source code, to connect explanations with implementation
- Follow the further-reading and YouTube links included in each topic
- Use the Beginner and Advanced labels to plan a study order
- Read the trade-off notes in the data structures section to understand when to choose each structure
Downloads
Strengths
- Covers a broad range of data structures and algorithms in one place
- Each topic links to explanations and further reading, including videos
- Available in many languages through translated README files
Trade-offs
- Described as examples and explanations rather than a tested library, so it is not designed for direct use in production code
- The README excerpt provided is truncated, so the full list of topics and details could not be fully verified here
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| javascript-algorithms (this) | 197k | Learning resource | beginner | 3 months ago | Students learning core computer science concepts in JavaScript |
| interviews | 65.5k | Learning resource | beginner | 1.5 years ago | Students preparing for their first software engineering interviews |
| Go | 18.2k | Learning resource | beginner | 3 months ago | Beginners learning Go who want to read working implementations of common algorithms |
| tech-interview-for-developer | 17.7k | Learning resource | beginner | 1.4 years ago | Korean-speaking junior developers preparing for technical interviews |
| Java | 66.7k | Learning resource | beginner | 4 days ago | Students learning algorithms and data structures in Java |
| C-Plus-Plus | 34.8k | Learning resource | intermediate | 1 months ago | Students learning algorithms and data structures in C++ |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.