All Projects → Algorithm-archive → Learn-Data_Structure-Algorithm-by-Javascript

Algorithm-archive / Learn-Data_Structure-Algorithm-by-Javascript

Licence: other
Data Structure and Algorithm explanations with Implementations by Javascript

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Learn-Data Structure-Algorithm-by-Javascript

C Sharp Algorithms
📚 📈 Plug-and-play class-library project of standard Data Structures and Algorithms in C#
Stars: ✭ 4,684 (+8416.36%)
Mutual labels:  graph-algorithms, sorting-algorithms, searching-algorithms
Algods
Implementation of Algorithms and Data Structures, Problems and Solutions
Stars: ✭ 3,295 (+5890.91%)
Mutual labels:  graph-algorithms, sorting-algorithms
Javascript Datastructures Algorithms
📚 collection of JavaScript and TypeScript data structures and algorithms for education purposes. Source code bundle of JavaScript algorithms and data structures book
Stars: ✭ 3,221 (+5756.36%)
Mutual labels:  graph-algorithms, sorting-algorithms
Learn some algorithm and data structure
从零开始回顾一下最简单最基础的算法与数据结构
Stars: ✭ 38 (-30.91%)
Mutual labels:  graph-algorithms, sorting-algorithms
DSA
Data Structures and Algorithms
Stars: ✭ 13 (-76.36%)
Mutual labels:  graph-algorithms, sorting-algorithms
Data-Structures-and-Algorithms
Implementation of various Data Structures and algorithms - Linked List, Stacks, Queues, Binary Search Tree, AVL tree,Red Black Trees, Trie, Graph Algorithms, Sorting Algorithms, Greedy Algorithms, Dynamic Programming, Segment Trees etc.
Stars: ✭ 144 (+161.82%)
Mutual labels:  graph-algorithms, sorting-algorithms
Advanced Algorithms
100+ algorithms & data structures generically implemented in C#.
Stars: ✭ 752 (+1267.27%)
Mutual labels:  graph-algorithms, sorting-algorithms
python3-algorithms
Python3 数据结构与算法的介绍及应用。1. 数据结构:数组、链表、栈、队列、树、堆、图; 2. 典型排序算法:冒泡排序、选择排序、插入排序、希尔排序、堆排序、归并排序、快速排序、桶排序、计数排序、基数排序; 3. 查找算法: 顺序查找、二分查找、哈希表查找、二叉查找树、平衡二叉查找树(AVL树、红黑树)、平衡多路查找树(B树、B+树);4. LeetCode 和《剑指Offer》刷题、多种方法的题解
Stars: ✭ 70 (+27.27%)
Mutual labels:  sorting-algorithms, searching-algorithms
Data Structures With Go
Data Structures with Go Language
Stars: ✭ 121 (+120%)
Mutual labels:  graph-algorithms, sorting-algorithms
Data structure and algorithms library
A collection of classical algorithms and data-structures implementation in C++ for coding interview and competitive programming
Stars: ✭ 133 (+141.82%)
Mutual labels:  graph-algorithms, sorting-algorithms
Dsa Geeksclasses
DSA-Self Paced With Doubt Assistance Course Solutions in Python (Python 3)
Stars: ✭ 137 (+149.09%)
Mutual labels:  graph-algorithms, sorting-algorithms
common-algorithms-js
Common algorithms implemented in JavaScript.
Stars: ✭ 34 (-38.18%)
Mutual labels:  graph-algorithms, sorting-algorithms
Data-Structures-and-Algorithms
Data Structures and Algorithms implementation in Python
Stars: ✭ 31 (-43.64%)
Mutual labels:  sorting-algorithms, searching-algorithms
py-algorithms
Algorithms and Data Structures, solutions to common CS problems.
Stars: ✭ 26 (-52.73%)
Mutual labels:  graph-algorithms, sorting-algorithms
Java-Questions-and-Solutions
This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
Stars: ✭ 34 (-38.18%)
Mutual labels:  sorting-algorithms, searching-algorithms
interview-cookbook
A playground for learning DataStructures, Algorithms, and Object-Oriented Concepts.
Stars: ✭ 25 (-54.55%)
Mutual labels:  sorting-algorithms, searching-algorithms
Nodorithm
NPM package for algorithms.
Stars: ✭ 22 (-60%)
Mutual labels:  sorting-algorithms, searching-algorithms
alvito
Alvito - An Algorithm Visualization Tool for Python
Stars: ✭ 52 (-5.45%)
Mutual labels:  sorting-algorithms, searching-algorithms
Algorithm Notes
Comprehensive algorithms solution to help engineers prepare their interviews and future study
Stars: ✭ 44 (-20%)
Mutual labels:  graph-algorithms, sorting-algorithms
Algorithms
A collection of common algorithms and data structures implemented in java, c++, and python.
Stars: ✭ 142 (+158.18%)
Mutual labels:  graph-algorithms, sorting-algorithms

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 to JavaScript

  • Data Structure

  • Searching

  • Sorting

  • Graph Algorithms

    • Graph Representation
    • Breadth First Search (BFS)
    • Depth First Search (DFS)
    • Topological Sort
    • Strongly Connected Components (SCC)
    • Minimum Spanning Tree (MST)
    • All Pairs Shortest Path (Floyd Warshall's Algorithm)
    • Single Source Shortest Path Algorithm
      • Djkastra's Algorithm
      • Bellman Ford Algorithm
    • Directed Acyclic Graph
    • Bipartite Matching
    • Articulation Point, Bridge
    • Euler Tour/Path
    • Hamiltonian Cycle
    • Stable Marriage Problem
    • Chinese Postman Problem
    • 2-satisfiability
    • Flow Algorithms
      • Maximum Flow
      • Minimum Cut
      • Min-Cost Max Flow
      • Maximum Bipartite Matching
      • Vertex Cover
  • Dynamic Programming

    • Rod Cutting
    • Maximum Sum (1D, 2D)
    • Coin Change
    • Longest Common Subsequence
    • Longest Increasing Subsequence
    • Matrix Multiplication
    • Edit Distance (Levenshtein distance)
    • 0/1 Knapsack
    • Travelling Salesman Problem
    • Optimal Binary Search Tree
  • Greedy Algorithms

    • Activity Selection/Task Scheduling
    • Huffman Coding
    • Knapsack Problem (Fractional Knapsack)
  • String Algorithms

    • Rabin-Karp Algorithm
    • Knuth-Morris-Pratt Algorithm
    • Z Algorithm
    • Aho-Korasick Algorithm
    • Manachers Algorithm
    • Boyr-Moore Algorithm
  • Number Theory

    • Greatest Common Divisor (GCD)
    • Longest Common Multiplier (LCM)
    • Euler Totient (Phi)
    • Primality Testing
    • Prime finding(Sieve of Eratosthenes)
    • Prime factorization
    • Factorial
    • Fibonacci
    • Counting, Permutation, combination
    • Exponentiation
    • Big Mod
    • Euclid, Extended euclid
    • Josephus Problem
    • Farey Sequence
    • Catalan numbers
    • Burnside's lemma/circular permutation
    • Modular inverse
    • Probability
    • Chinese Remainder Theorem
    • Gaussian Elimination method
    • Dilworth's Theorem
    • Matrix Exponentiation
  • Computational Geometry

    • Pick's Theorem
    • Convex hull
    • Line Intersection
    • Point in a polygon
    • Area of a polygon
    • Line Sweeping
    • Polygon intersection
    • Closest Pair
  • Game Theory

    • Take Away Game
    • Nim's Game
    • Sprague-grundy Number
  • Others


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:

  • Six data types that are primitives:

    • Boolean (true and false)
    • Null (invalid object or address has the value null)
    • Undefined (a variable that has not been assigned a value has the value undefined)
    • Number (integer and floating point values ranging from -(253 -1) to (253 -1), +Infinity, -Infinity and NaN(not-a-number) )
    • String (Sequence of textual characters. Strings are immutable in JavaScript)
    • Symbol (new in ECMAScript 6)
  • Object

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:

  • There are no true private properties available in ES6 yet. So, in classes no workarounds or hacks used to implement private properties. There are several proposals and initiative ongoing to introduce it in ECMAScript. Hoping that would be done soon and we will then add it in our code.
  • We tried to implement the data structures and some algorithms in separate modules so that they can be used independently in any other codes. While import is indeed part of ES6, it is unfortunately not yet supported by any native environments, Node or browser. Until the native support introduced the easy workaround is to stick with the old CommonJS Module format(Which is supported in NodeJS and as we advised earlier to test our codes in NodeJS, so we are sticking with it). The modules will be exported using CommonJS Module format and imported by 'require'. Though there are other ways like Babel, Rollup etc., but that need some build configurations(And we don't want to make our codes more complicated). And at the end babel will convert the code to require and module.exports anyway.

FAQ

  • Why you didn't use prototype methods in Objects?

    => Well, we could've. But before argue on that, you might want to read this nice article. We chose to follow the philosophy described on that article. But still, you can easily rewrite the codes of this repository using 'prototypal methods' for your own use.

Useful Links:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].