boopathi4291 / dsa.js

Data Structures and Algorithms using JavaScript

Home Page:https://adrianmejia.com/tags/tutorial-algorithms/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data Structures and Algorithms in JavaScript

This repository covers the implementation of the most important algorithms and data structures.

This goes along with these posts series that explain each implementation in details.

Interactive Data Structures

Data Structures

We are covering the following data structures.

Linear Data Structures

  1. Arrays: Built-in in most languages so not implemented here. Code | Details.
  2. Linked Lists: each data node has a link to the next (and previous). Code | Details.
  3. Queue: data flows in a "first-in, first-out" (FIFO) manner. Code | Details.
  4. Stacks: data flows in a "last-in, first-out" (LIFO) manner. Code | Details.

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 | Details
    1. Binary Trees: same as tree but only can have two children at most. Details
    2. Binary Search Trees (BST): same as binary tree, but the nodes value keep this order left < parent < rigth. Code | Details
    3. AVL Trees: Self-balanced BST to maximize look up time. Code | Details
    4. Red-Black Trees: Self-balanced BST more loose than AVL to maximize insertion speed. Code | Details
  2. Maps: key-value store.
    1. Hash Maps: implements map using a hash function. Code | Details
    2. Tree Maps: implement map using a self-balanced BST. WIP
  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 | Details

Algorithms

  1. Searching algorithms (WIP)
  2. Sorting algorithms (WIP)

Notes

Some notes while working on this project

Tests

Running one test without changing file

jest -t '#findNodeAndParent'

Running one test changing code

it.only('should return with an element and its parent', () => {
// ...
});

English Words

Getting some (200k+) English words are useful for testing and benchmarking.

cat /usr/share/dict/words > benchmarks/dict.txt

ESLint

Disabling ESLints

somthing(t) =>  1  // eslint-disable-line no-unused-vars
// eslint-disable-next-line no-use-before-define
const  thing  =  new Thing();

/*eslint-disable */
//suppress all warnings between comments
alert('foo');
/*eslint-enable */

/* eslint-disable no-alert, no-console */
alert('foo');
console.log('bar');
/* eslint-enable no-alert */

About

Data Structures and Algorithms using JavaScript

https://adrianmejia.com/tags/tutorial-algorithms/

License:MIT License


Languages

Language:JavaScript 100.0%