trekhleb

javascript-algorithms: Learn Algorithms and Data Structures in JavaScript

A JavaScript collection of classic algorithms and data structures, with explanations and links to further reading. It suits learners and interview candidates who want to study implementations, compare approaches, and run tests locally.

View on GitHub Compare
Stars
197k
Forks
31k
Stars, last 30 days
+50
Last commit
4 months ago
Contributors
100+

Our take

Quietno commits in the last 90 days and no release in a year

Health score

37/100

How it is scored
Activity
19
Community
62
Issues
46
Pull requests
20

+50 stars in the last 30 days

  • More contributors than 78% of the projects we track

This is a broad, well-established learning reference, but its recent quiet period and concentrated contribution history make it better suited to study than as a dependency requiring active maintenance.

Good fit if

  • You want JavaScript examples with explanations across a wide range of algorithms and data structures.
  • You are preparing for interviews and want to explore implementations and algorithmic paradigms.
  • You can use the repository as educational material and independently assess any code reused in a product.

Look elsewhere if

  • You need a library with recent releases or ongoing changes: there have been no commits in the last 90 days and no release in over a year.
  • Your adoption depends on broadly distributed maintenance: most measured contributions come from one person, and recent issue and pull request activity is limited.
  • You need a production-ready package with a release cadence and support commitments rather than a learning repository.
All health signals
Last commit2026-07-26 (4 months ago)
Commits, last 90 days0
Releases, last 12 months0
Contributors100+ (top contributor: 84% of commits)
Issues closed, last 90 days1
Pull requests merged, last 90 days0
Project age8 years

Checked on 2026-11-17 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

196,733

Forks

30,970

Change since Nov 16, 2026: +5 stars·-3 forks

Overview

javascript-algorithms is a JavaScript collection of algorithms and data structures, each organized with explanations and links to further reading. It addresses the gap between knowing an algorithm's name and understanding how it works by pairing implementations with learning material.

The repository spans beginner and advanced topics, from basic collections and sorting to graph algorithms, dynamic programming, and machine learning examples. It is primarily a study and reference resource, rather than a packaged library positioned for direct production use.

Key Features

  • Implementations of common structures including linked lists, queues, heaps, trees, graphs, and caches.
  • Algorithms grouped by topic, including sorting, searching, strings, graphs, math, and image processing.
  • Examples organized by design approach, such as greedy methods, dynamic programming, divide and conquer, and backtracking.
  • Separate documentation for each topic, with explanations and further reading links, including videos.
  • Beginner and advanced labels help readers navigate the breadth of material.
  • Tests and linting can be run locally with npm scripts.
  • README translations are available in multiple languages.

Use Cases

  • A JavaScript learner can study a data structure alongside its implementation and explanation.
  • An interview candidate can review standard problems and compare alternative approaches, including dynamic programming and brute force.
  • An instructor or study group can use the topic lists and linked readings to structure lessons on algorithms and complexity.
  • A developer can consult the implementations as a reference when exploring a specific algorithm, while validating suitability before reusing code in an application.

What you need

Detected in the repository

  • Node.js >=22.0.0 (from package.json)
  • Automated checks on GitHub Actions

License in plain words

MITpermissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the copyright and license notice
  • Share your changes: no

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install dependencies and run the tests:

npm install
npm test

The repository requires Node.js 22 or later. See the README for linting, named test runs, and the playground workflow.

Alternatives

  • ACM-ICPC-Algorithms: It provides C++ implementations geared toward ACM-ICPC contests, rather than JavaScript implementations with learner-focused explanations.
ProjectLanguageLicenseStarsStatus
javascript-algorithmsJavaScriptMIT197kQuiet
ACM-ICPC-AlgorithmsC++–2.3kInactive

Considerations

The project is marked quiet by its recent activity: it has had no commits in the last 90 days, no releases in the past year, and very little recent issue or pull request closure activity. Its measured contributor history is concentrated, so teams adopting implementations should plan to review and maintain any code they depend on. The README presents the repository as examples and educational material, not as a supported production package. The project uses the MIT license.

Found this useful?

Share it with someone who would like javascript-algorithms.

Comparisons