javascript-algorithms
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
Algorithms in JavaScript, each with its own explainer
This repository holds JavaScript examples of many algorithms and data structures. Every entry comes with its own README of explanations and links for further reading, including YouTube videos.
The layout
Each algorithm and data structure has its own separate README, with related explanations and links for further reading that include YouTube videos. That is the organizing idea: instead of one giant reference, you get a folder full of small, self-contained explainers. JavaScript is the primary language and the license is MIT.
Data structures
The list runs long. Linked list, doubly linked list, queue, stack, deque, hash table, heap, priority queue, trie, tree, binary search tree, AVL tree, red-black tree, segment tree, Fenwick tree, graph, disjoint set, Bloom filter, and LRU cache. The README adds a warning that every data structure has its own trade-offs, and that choosing one is more important than implementing it.
Algorithms by topic and paradigm
Algorithms are filed two ways. By topic covers math, bit manipulation, binary floating point, factorial, Fibonacci, prime factors, primality tests, and matrices. By paradigm organizes them into brute force, greedy, divide and conquer, and dynamic programming, with examples like binary search, Dijkstra's algorithm, and the traveling salesman problem. Two organization schemes mean the same algorithm can show up in both places.
Working with the code
The README suggests deleting the node modules folder and reinstalling npm packages when linting or tests fail. Node version 16 or later is expected, and nvm use picks the right one. A playground file under src/playground lets people experiment, with tests written next to it. Big O notation tables and complexity charts close out the reference material.
Editorial conclusion
The README reads like a textbook appendix: definitions, tables, and a note that each data structure has trade-offs. No benchmarks are claimed beyond the Big O tables it prints itself.
Community notes