The Wayback Machine - https://web.archive.org/web/20190428120635/https://github.com/amejiarosario/dsa.js
Skip to content
Data Structures and Algorithms explained and implemented in JavaScript
Branch: master
Clone or download
amejiarosario Merge pull request #10 from Hongarc/npm
chore: only publish `src` to npm
Latest commit 9bb9577 Apr 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
benchmarks rename hash-map files Oct 7, 2018
book docs(linked-lists): better doc for insert middle Apr 19, 2019
docs docs files Sep 27, 2018
lab chore: trim trailing whitespace Apr 21, 2019
src fix(linked-list): insert in the middle bug Apr 19, 2019
.editorconfig chore: remove old `editorconfig` file Apr 21, 2019
.eslintignore --wip-- [skip ci] Mar 29, 2019
.eslintrc.js --wip-- [skip ci] Mar 29, 2019
.gitignore add images Apr 11, 2019
.node-version insertion sort working Oct 23, 2018
.travis.yml add ci script Apr 4, 2019
CHANGELOG.md bump version Apr 19, 2019
CONTRIBUTING.md docs: add guidelines and notes Apr 5, 2019
LICENSE Initial commit Dec 28, 2016
README.md docs(readme): remove weird dots Apr 19, 2019
deprecated-README.adoc remove adoc readme since maintaining two is insane Apr 4, 2019
jasmine-runner.js add tests for linkedList Dec 28, 2016
jasmine.json add tests for linkedList Dec 28, 2016
notes.md bump version Apr 19, 2019
package-lock.json --wip-- [skip ci] Mar 29, 2019
package.json chore: only publish `src` to npm Apr 21, 2019
wallaby.json add tests for linkedList Dec 28, 2016

README.md

Data Structures and Algorithms in JavaScript

Build Status npm version

This repository covers the implementation of the classical algorithms and data structures in JavaScript.

Usage

You can clone the repo or install the code from NPM:

npm install dsa.js

and then you can import it into your programs or CLI

const { LinkedList, Queue, Stack } = require('dsa.js');

For a full list of all the exposed data structures and algorithms see.

Book

You can check out the dsa.js book that goes deeper into each topic and provide additional illustrations and explanations.

  • Algorithmic toolbox to avoid getting stuck while coding.
  • Explains data structures similarities and differences.
  • Algorithm analysis fundamentals (Big O notation, Time/Space complexity) and examples.
  • Time/space complexity cheatsheet.

dsajs algorithms javascript book

Data Structures

We are covering the following data structures.

Interactive Data Structures

Linear Data Structures

  1. Arrays: Built-in in most languages so not implemented here. Array Time complexity

  2. Linked Lists: each data node has a link to the next (and previous). Code | Linked List Time Complexity

  3. Queue: data flows in a "first-in, first-out" (FIFO) manner. Code | Queue Time Complexity

  4. Stacks: data flows in a "last-in, first-out" (LIFO) manner. Code | Stack Time Complexity

Non-Linear Data Structures

  1. Trees: data nodes has zero or more adjacent nodes a.k.a. children. Each node can only have one parent node otherwise is a graph not a tree. Code | Docs

    1. Binary Trees: same as tree but only can have two children at most. Code | Docs

    2. Binary Search Trees (BST): same as binary tree, but the nodes value keep this order left < parent < right. Code | BST Time complexity

    3. AVL Trees: Self-balanced BST to maximize look up time. Code | AVL Tree docs | Self-balancing & tree rotations docs

    4. Red-Black Trees: Self-balanced BST more loose than AVL to maximize insertion speed. Code

  2. Maps: key-value store.

    1. Hash Maps: implements map using a hash function. Code | HashMap time complexity

    2. Tree Maps: implement map using a self-balanced BST. Code | TreeMap docs | TreeMap time complexity

  3. Graphs: data nodes that can have a connection or edge to zero or more adjacent nodes. Unlike trees, nodes can have multiple parents, loops. Code | Graph Time Complexity

Algorithms

  • Sorting algorithms

  • Greedy Algorithms

    • Fractional Knapsack Problem. Code | Docs
  • Divide and Conquer

  • Dynamic Programming

    • Fibonacci with memoization. Code | Docs
  • Backtracking algorithms

You can’t perform that action at this time.