Skip to content

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
Step-by-step guide: how to use javascript-algorithmsInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Clone and build from source

    You'll need: Git

    Clone the repository

    git clone https://github.com/trekhleb/javascript-algorithms.git
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
javascript-algorithms (this)197kLearning resourcebeginner3 months agoStudents learning core computer science concepts in JavaScript
interviews65.5kLearning resourcebeginner1.5 years agoStudents preparing for their first software engineering interviews
Go18.2kLearning resourcebeginner3 months agoBeginners learning Go who want to read working implementations of common algorithms
tech-interview-for-developer17.7kLearning resourcebeginner1.4 years agoKorean-speaking junior developers preparing for technical interviews
Java66.7kLearning resourcebeginner4 days agoStudents learning algorithms and data structures in Java
C-Plus-Plus34.8kLearning resourceintermediate1 months agoStudents 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.