A community-maintained collection of algorithms implemented in Python, intended for learning and education.
trekhleb/javascript-algorithms
A JavaScript collection of classic algorithms and data structures, each with explanations and further reading links.
- Stars
- 196,685
- Forks
- 31,010
- Open issues
- 413
- Last commit
- 3 months ago
What is it?
This repository implements a wide range of common algorithms and data structures in JavaScript. It covers basic structures such as linked lists, stacks, queues, hash tables and heaps, as well as trees (BST, AVL, red-black, segment and Fenwick trees), graphs, tries, and LRU caches.
The algorithm side is organized by topic (math, sets, strings, searching, sorting, graphs, cryptography, and a few machine learning examples) and by paradigm such as brute force, greedy, divide and conquer, dynamic programming, and backtracking. Each entry is marked by difficulty level and links to its own explanation page.
The repository also includes Big O complexity tables for data structures and sorting algorithms, and provides npm scripts for installing dependencies, running ESLint, and executing tests by name.
Key features
- 01Implements core data structures including linked lists, heaps, tries, and several tree variants.
- 02Organizes algorithms by topic and by paradigm such as dynamic programming and backtracking.
- 03Each algorithm links to a separate explanation page with further reading and video references.
- 04Includes Big O complexity comparison tables for data structures and sorting algorithms.
- 05Provides npm scripts for linting and running tests, including filtering tests by name.
Use cases
- Preparing for technical interviews that test algorithms in JavaScript.
- Studying how a data structure or sorting algorithm works by reading its implementation.
- Looking up time and space complexity for common structures and sorts.
- Using the code as a reference when implementing similar logic in a JavaScript project.
Topics
FAQ
- What is javascript-algorithms?
- A JavaScript collection of classic algorithms and data structures, each with explanations and further reading links. This repository implements a wide range of common algorithms and data structures in JavaScript. It covers basic structures such as linked lists, stacks, queues, hash tables and heaps, as well as trees (BST, AVL, red-black, segment and Fenwick trees), graphs, tries, and LRU caches.
- Is javascript-algorithms free to use? What license does it have?
- javascript-algorithms is open source under the MIT license. Check the license terms before using it in commercial products.
- Is javascript-algorithms still maintained?
- Updated within 6 months. The last commit to javascript-algorithms was on Jul 26, 2026.
- What can I use javascript-algorithms for?
- Preparing for technical interviews that test algorithms in JavaScript. Studying how a data structure or sorting algorithm works by reading its implementation. Looking up time and space complexity for common structures and sorts. Using the code as a reference when implementing similar logic in a JavaScript project.
- Where can I get javascript-algorithms?
- The source code and installation instructions are on GitHub: https://github.com/trekhleb/javascript-algorithms
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A curated, bilingual-tagged list of online robotics courses, university lectures, books and hands-on resources for self-learners.
A self-paced, free path through a full computer science curriculum built from online courses and books, organized into Intro, Core and Advanced CS.
A curated list of university-level computer science courses that include video lectures, organized by topic.
A long-running list of ReactJS interview questions with answers, covering core React, Router, Redux, testing and React Native.
Open source React and Svelte libraries for building interactive node-based UIs such as flowcharts, graphs and workflow editors.