julia-dizhak / javascript-algorithms

Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript, demo is

Home Page:https://julia-dizhak.github.io/javascript-algorithms/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Computer Science in JavaScript

The repo contains JavaScript implementations of different famous computer science algorithms.

As well below you will find solution for leetcode problems divided by dependency of topic relation.

Description

Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript. As well contains description and characteristics: runtime or complexity. Without using in-built methods of JavaScript, for example, sort(), reverse() and etc. Solutions include as well measuring of time complexity.

Demo

Hosted on GitHub Pages, Demo

Development

Technology ES6, Yarn, Babel, Jest with a syntax highlighter Highlightjs.

Tests run by npm test

This project was bootstrapped with Create React App

Author

by Yuliia (Julia) Dizhak started on 12/21/17

Complexity terms

Symbol Name Performance
Ω big-omega best-case performance
θ big-theta average
O big-oh worst

Main Data Structures implementations by Javascript

  • Strings manipulation

    Complexity: Time Space
    iterative, 2 loops O(n^2) 0(?)
  • Array

    • Array built-in methods
    Complexity: Time Space
    push O(1) 0(1)
    pop O(1) 0(1)
    shift O(n) 0(1)
    unshift O(n) 0(1)
    delete O(n) 0(1)
    reverse, splice, slice, concat O(n) 0(1)
  • Linked Lists

    Complexity: Time Space
    get(index) O(n) 0(1)
    addAtHead(val) O(1) 0(1)
    addAtTail(val) O(n) 0(1)
    addAtIndex(index, val) O(n) 0(1)
    deleteAtIndex(index) O(n) 0(1)
  • Stack implementation

    Complexity: Time Space
    All operations O(1) 0(N)?
  • Queue implementation

    Complexity Time: enqueue dequeue
    1 Pointer (head) O(n) 0(1)
    2 Pointers (head and tail) O(1) 0(1)
  • Hash implementation

    Complexity: time space
    add O(1) 0(1)
    remove O(1) 0(1)
    contains O(1) 0(1)
  • Binary Tree (BT)

    Complexity: Time Space
    insert iterative + Queue O(log n) 0(1)
    insert(node) recursion O(?) 0(?)
    ...
  • Binary Tree Traversal

    Approaches: Time Space
    DFS+ Stack O(n) 0(h)
    Recursion O(n) 0(n)
    Approaches: Time Space
    Iterative + Queue O(n) 0(n/2 = n)
    Approaches: Time Space
    BFS + Queue O(n) 0(n)
    Recursion O(n) 0(n)
  • Binary Search Tree (BST) Implementation

    Complexity: Time Space
    Insert Recursive / iterative O(log n) 0(n) / O(1)
    ...
  • Heap

    Complexity: Time Space
    insert(val) O(log n) 0(1)
    deleteMax O(log n) O(1)
    max O(1) O(1)

Bitwise operator in JS

Searching and Sorting

Problem solving on leetcode

Programming methods/paradigms

OOP in JS

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

Folder structure

The most recent packages are found in these directories:

  • src/ds - the implementation source code
  • src/ds/***.spec.js - tests for the implementation source code

TODO:

  • scrollTo works with bug
  • details toggle works with bug (sometimes)
  • display level: beginner, medium, ... (like corners)
  • generate test coverage
  • performance test
  • seo

About

Collection of classic computer science paradigms, algorithms, and approaches written in JavaScript, demo is

https://julia-dizhak.github.io/javascript-algorithms/


Languages

Language:JavaScript 99.5%Language:CSS 0.4%Language:HTML 0.1%