• Stars
    star
    9,059
  • Rank 3,986 (Top 0.08 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 15 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript.

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

More Repositories

1

humanfs

A modern filesystem API for JavaScript
JavaScript
486
star
2

env

A utility for verifying environment variables are present
JavaScript
375
star
3

momoa

A JSON parser, tokenizer, traverser, and printer.
JavaScript
313
star
4

print-ready

A JavaScript-powered CLI for converting HTML into PDFs
JavaScript
115
star
5

pledge

A custom promise implementation for JavaScript
JavaScript
90
star
6

puppeteer-data-extractor

JavaScript
46
star
7

object-schema

DEPRECATED. Use eslint/object-schema instead.
JavaScript
32
star
8

config-array

DEPRECATED. Use eslint/config-array instead
JavaScript
30
star
9

number-to-words

A JavaScript function to convert a number into words
JavaScript
30
star
10

tweet

A CLI for posting to Twitter
JavaScript
28
star
11

module-importer

Universal importer for CommonJS and ESM in Node.js
JavaScript
26
star
12

eslint-simple-rule

A utility for creating simple ESLint rules
JavaScript
23
star
13

async-event-emitter

Asynchronous version of EventEmitter for JavaScript
JavaScript
20
star
14

retry

A JavaScript utility for retrying async methods that reject errors
JavaScript
19
star
15

gitignore-to-minimatch

Utility to convert gitignore patterns into minimatch patterns
JavaScript
11
star
16

astro-jekyll

Toolkit to make transferring a Jekyll website to Astro simple!
JavaScript
9
star
17

toot

CLI for posting to Mastodon
JavaScript
9
star
18

humanwhocodes.com

HTML
8
star
19

ordered-set

A set data structure that maintains the order of insertion
JavaScript
8
star
20

object-store

JavaScript
8
star
21

array-with-default

An implementation of Array with a default for missing values
JavaScript
7
star
22

github-comment

A simple CLI for posting comments to GitHub issues and pull requests
JavaScript
6
star
23

memory

A JavaScript implementation of dynamic memory.
JavaScript
5
star
24

disqus-export

Disqus comments exporter
JavaScript
2
star
25

hello-nodejs-service

A simple microservice as an example for running Node.js on Google Cloud Run
JavaScript
2
star
26

hello-deno-service

An example Deno service to run on Google Cloud Run
JavaScript
2
star
27

markdown-it-markua-aside

markdown-it plugin for Markua asides and blurbs
JavaScript
1
star