# System map — trekhleb/javascript-algorithms

> Canonical page: https://codevetter.com/unpack/javascript-algorithms/system-map

# System map — trekhleb/javascript-algorithms

Scanned commit 85293e3e2b88f4d2ce330d956b139cf628aa1e82 (2026-07-25). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

The repo is a flat monorepo of independent algorithm/data-structure modules — there is no app server, CLI, or build artifact; the runtime boundary is simply Node.js >=22 running Jest 30 over ES-module sources transpiled by @babel/preset-env. Code lives in three subtrees: src/data-structures (14 categories), src/algorithms (14 topic dirs), plus src/utils and a src/playground scratch area. Cross-cutting wiring is minimal: a single shared Comparator utility and a small inheritance graph (Sort -> QuickSort et al.; Heap -> MinHeap/MaxHeap -> PriorityQueue). Quality gates are npm run lint (eslint airbnb config) on pre-commit via husky, and npm run coverage in GitHub Actions CI on Node 22.x with Codecov upload.
- There is no application entrypoint or index.js at the repo root even though package.json declares "main": "index.js"; the package is a code collection consumed by reading/importing individual modules, not a runnable or publishable artifact. — [package.json#L29](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/package.json#L29) [README.md#L16-21](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/README.md#L16-L21)
- npm scripts define the entire developer workflow: `npm run lint` (eslint ./src/**), `npm test` (jest), `npm run coverage` (jest --coverage), `npm run ci` (lint + coverage), and `prepare` installs husky hooks. — [package.json#L30-36](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/package.json#L30-L36)
- Source is ES modules transpiled for tests by @babel/preset-env via .babelrc; there is no bundler, TypeScript, or build step. — [.babelrc](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/.babelrc) [package.json#L37-49](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/package.json#L37-L49)
- The code is organized into src/data-structures (linked-list, doubly-linked-list, queue, stack, deque, hash-table, heap, priority-queue, trie, tree/{avl,red-black,segment,fenwick,binary-search-tree}, graph, disjoint-set, bloom-filter, lru-cache) and src/algorithms (sorting, search, graph, tree, linked-list, math, string, sets, cryptography, image-processing, ml, statistics, stack, uncategorized). — [README.md#L43-80](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/README.md#L43-L80) [src/data-structures/linked-list/LinkedList.js](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/linked-list/LinkedList.js) [src/algorithms/sorting/quick-sort/QuickSort.js](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/algorithms/sorting/quick-sort/QuickSort.js)
- src/utils/comparator/Comparator.js is the single shared utility: it wraps an optional custom compare function and exposes equal/lessThan/greaterThan/lessThanOrEqual/greaterThanOrEqual/reverse, and is injected into LinkedList, Heap, Sort, and PriorityQueue constructors. — [src/utils/comparator/Comparator.js#L7-23](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/utils/comparator/Comparator.js#L7-L23) [src/data-structures/linked-list/LinkedList.js#L15](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/linked-list/LinkedList.js#L15) [src/data-structures/heap/Heap.js#L18](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/heap/Heap.js#L18) [src/data-structures/priority-queue/PriorityQueue.js#L2-17](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/priority-queue/PriorityQueue.js#L2-L17)
- A small inheritance hierarchy provides shared structure: abstract Heap throws if constructed directly and is extended by MinHeap and MaxHeap; PriorityQueue extends MinHeap and swaps in a priority-aware Comparator. — [src/data-structures/heap/Heap.js#L6-19](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/heap/Heap.js#L6-L19) [src/data-structures/heap/MinHeap.js#L1](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/heap/MinHeap.js#L1) [src/data-structures/heap/MaxHeap.js](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/heap/MaxHeap.js) [src/data-structures/priority-queue/PriorityQueue.js#L1-17](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/data-structures/priority-queue/PriorityQueue.js#L1-L17)
- The abstract Sort base class normalizes {compareCallback, visitingCallback} in initSortingCallbacks and forces subclasses to implement sort() (throws 'sort method must be implemented'); QuickSort and the other 10 sorting dirs subclass it. — [src/algorithms/sorting/Sort.js#L11-34](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/algorithms/sorting/Sort.js#L11-L34) [src/algorithms/sorting/quick-sort/QuickSort.js#L3](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/src/algorithms/sorting/quick-sort/QuickSort.js#L3)
- ESLint uses the airbnb preset with jest plugin and five relaxed rules (no-bitwise, no-lonely-if, class-methods-use-this, arrow-body-style, no-loop-func); a React version setting exists in .eslintrc despite the repo containing no React code. — [.eslintrc#L1-21](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/.eslintrc#L1-L21)
- GitHub Actions CI (.github/workflows/CI.yml) runs on push/PR to master on ubuntu-latest with a Node 22.x matrix: npm i -> npm run lint -> npm run coverage -> codecov/codecov-action@v4 upload. — [.github/workflows/CI.yml#L1-35](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/.github/workflows/CI.yml#L1-L35)
- Husky is wired through the `prepare` script and .husky/pre-commit runs `npm run lint` on every commit, so lint is the only client-side gate; tests are enforced only in CI. — [.husky/pre-commit](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/.husky/pre-commit) [package.json#L35](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/package.json#L35)
- Engines require node >=22.0.0 and npm >=10.0.0; devDependencies are limited to babel, eslint stack, jest 30, @types/jest, husky, and pngjs (used only by the seam-carving image test). — [package.json#L37-53](https://github.com/trekhleb/javascript-algorithms/blob/85293e3e2b88f4d2ce330d956b139cf628aa1e82/package.json#L37-L53)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
