humanwhocodes/computer-science-in-javascript
{ "createdAt": "2009-04-12T01:03:24Z", "defaultBranch": "master", "description": "Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript. ", "fullName": "humanwhocodes/computer-science-in-javascript", "homepage": "http://www.nczonline.net/", "language": "JavaScript", "name": "computer-science-in-javascript", "pushedAt": "2023-12-15T05:31:17Z", "stargazersCount": 9123, "topics": [], "updatedAt": "2025-11-24T18:28:27Z", "url": "https://github.com/humanwhocodes/computer-science-in-javascript"}Computer Science in JavaScript
Section titled “Computer Science in JavaScript”If you find this useful, please consider supporting my work with a donation.
Description
Section titled “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
Section titled “Folder Structure”The most recent packages are found in these directories:
src- the implementation source codetests- 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 yetencodings- encoding implementations that have not been updated yetalgorithms- miscellanous algorithm implementations that have not been updated yet
As I update these, implementations will move from these folders into src.
Branches
Section titled “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
Section titled “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-javascriptThen install the dependencies:
$ npm installYou can then run tests like this:
$ npm testUpdated Blog Posts (2019)
Section titled “Updated Blog Posts (2019)”These are the most recent blog posts covering the most recent version of the code.
Data Structures
Section titled “Data Structures”Original Blog Posts
Section titled “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
Section titled “Data Structures”- Binary Search Tree: Part 1, Part 2
- Doubly Linked List
- Linked List
Sorting Algorithms
Section titled “Sorting Algorithms”Other Algorithms
Section titled “Other Algorithms”Note on Code Style
Section titled “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
Section titled “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
Section titled “License”MIT