MCPcopy Index your code
hub / github.com/humanwhocodes/computer-science-in-javascript

github.com/humanwhocodes/computer-science-in-javascript @main sqlite

repository ↗ · DeepWiki ↗
152 symbols 268 edges 27 files 138 documented · 91%
README

Computer Science in JavaScript

by Nicholas C. Zakas

If you find this useful, please consider supporting my work with a donation.

Description

Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript. This is the source code for the series of blog posts on my website.

Folder Structure

The most recent packages are found in these directories:

  • src - the implementation source code
  • tests - tests for the implementation source code

These directories contain old implementations that will be replaced eventually, they are just here to avoid confusing people who find this repo through the old blog posts:

  • data-structures - data structure implementations that have not been updated yet
  • encodings - encoding implementations that have not been updated yet
  • algorithms - miscellanous algorithm implementations that have not been updated yet

As I update these, implementations will move from these folders into src.

Branches

  • 2009 - the branch containing all of the original implementations as reflected in my 2009 blog post series.
  • master - the branch where I'm updating the original implementations to use ECMAScript 2018 and later features.

Installing

You must be using Node.js v8 or later.

First, clone the repo:

$ git clone git://github.com/humanwhocodes/computer-science-in-javascript.git
$ cd computer-science-in-javascript

Then install the dependencies:

$ npm install

You can then run tests like this:

$ npm test

Updated Blog Posts (2019)

These are the most recent blog posts covering the most recent version of the code.

Data Structures

Original Blog Posts

At some point I will update these blog posts for the new implementations. For now, they still refer only to the 2009 version of this code.

Data Structures

Sorting Algorithms

Other Algorithms

Note on Code Style

You may find the code style of this module to be overly verbose with a lot of comments. That is intentional, as the primary use of this module is intended to be for educational purposes. There are frequently more concise ways of implementing the details of this class, but the more concise ways are difficult for newcomers who are unfamiliar with linked lists as a concept or JavaScript as a whole.

Issues and Pull Requests

As this is part of series of tutorials I'm writing, only bug fixes will be accepted. No new functionality will be added to this module.

License

MIT

Core symbols most depended-on inside this repo

add
called by 440
src/data-structures/linked-list/linked-list.js
set
called by 47
src/data-structures/hash-map/hash-map.js
assertListValues
called by 33
tests/data-structures/circular-linked-list/circular-linked-list.js
assertListValues
called by 32
tests/data-structures/linked-list/linked-list.js
assertListValues
called by 32
tests/data-structures/doubly-linked-list/doubly-linked-list.js
assertListValues
called by 32
tests/data-structures/circular-doubly-linked-list/circular-doubly-linked-list.js
get
called by 29
src/data-structures/hash-map/hash-map.js
remove
called by 29
src/data-structures/linked-list/linked-list.js

Shape

Method 92
Function 36
Class 24

Languages

TypeScript100%

Modules by API surface

src/data-structures/binary-heap/binary-heap.js21 symbols
src/data-structures/doubly-linked-list/doubly-linked-list.js20 symbols
src/data-structures/circular-doubly-linked-list/circular-doubly-linked-list.js19 symbols
src/data-structures/hash-map/hash-map.js18 symbols
src/data-structures/circular-linked-list/circular-linked-list.js18 symbols
src/data-structures/linked-list/linked-list.js17 symbols
src/data-structures/binary-search-tree/binary-search-tree.js15 symbols
algorithms/sorting/quicksort/quicksort.js3 symbols
encodings/base64/base64.js2 symbols
algorithms/sorting/selection-sort/selection-sort.js2 symbols
algorithms/sorting/merge-sort-recursive/merge-sort-recursive.js2 symbols
algorithms/sorting/merge-sort-recursive/merge-sort-inplace.js2 symbols

Dependencies from manifests, versioned

@humanwhocodes/doubly-linked-list2.2.0 · 1×
chai4.2.0 · 1×
eslint5.10.0 · 1×
mocha5.2.0 · 1×

For agents

$ claude mcp add computer-science-in-javascript \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact