Home

Awesome

Learn Data Structure and Algorithms by JavaScript

You need to have basic understanding of the JavaScript programming language to proceed with the codes from this repository.

Table of Contents


Introduction

JavaScript is a loosely typed or a dynamic language. That means you don't have to declare the type of a variable ahead of time. The type will get determined automatically while the program is being processed. That also means that you can have the same variable as different types:

var foo = 42;    // foo is now a Number
var foo = 'bar'; // foo is now a String
var foo = true;  // foo is now a Boolean

Data Types in JavaScript

The latest ECMAScript standard defines seven data types:

Arrays

JavaScript Arrays are regular objects for which there is a particular relationship between integer-key-ed properties and the 'length' property. Additionally, arrays inherit from Array.prototype which provides to them a handful of convenient methods to manipulate arrays like indexOf (searching a value in the array) or push (adding an element to the array), etc. This makes arrays a perfect candidate to represent lists or sets.

More details about data types in JavaScript:

Object Oriented Programming in JavaScript

Big-O Notation and Time Complexity Analysis

Algorithms in plain English: time complexity and Big-O notation Big-O Cheat Sheet Link A beginner's guide to big-O notation

How to Use

The easiest way to run and test the codes from this repository is to use nodejs (I have checked my code using nodejs v6.5.0 in an Windows machine).

Install it in your machine and add it to your environment path so that it is accessible in terminal commands.

Then you can run a JavaScript file like this:

node file.js

ES6/ES2015 implementations

There are ES6 implementations of the Data Structures and Algorithms in their respective folders within a separate folder named es6. Couple of things to notice here:

FAQ

Useful Links: