/javascript-algorithms

Some data structures implemented by JavaScript and some algorithms' problems solved in Javascript.

Primary LanguageJavaScript

Javascript algorithms & data structures

Sort algorithms

Some kinds of sort algorithms, and they are implemented in javascript.

  • bubble sort
  • heap sort
  • insert sort
  • merge sort
  • quick sort
  • selection sort
  • shell sort

Leetcode

Some solutions of leetcode's problems.

Data structure

Data structures implemented in Javascript.

  • stack
  • queue
  • singlely linked list
  • doublely linked list
  • tree

Questions from 《IT-Interview》

Stack & queue

  • Stack with getMin and reverse
  • Stack with sort implemented by another stack
  • Queue of dogs and cats
  • Hanoi Tower with order implemented by recursion
  • Hanoi Tower with order implemented by stack
  • Get max numbers in the window of an array
  • Get the max area of a matrix
  • Get number of sub-arraies which suits the equation: max - min <= num

Linked list

  • Print the common part of two ordered linked list
  • Remove the nth node from tail
  • Remove the node at the position of a/b
  • Reverse the linked list
  • Reverse part of the linked list
  • Remove nodes of a cyclic linked list until one node left
  • Check a linked list is palindrome or not
  • Sort the linked list by the prviot
  • Copy the linked list with a rand pointer
  • Add two int linked list together
  • Find the first crossing node of two linked lists.
  • Reverse a linked list each k nodes.
  • Remove the duplicate nodes in a linked list.
  • Remove the nodes by given value.
  • Convert a search binary tree to a doublely linked list.
  • Selection sort of a singlely linked list.
  • Quirky ways of removing nodes in a linked list.
  • Insert nodes into a sorted circlely linked list.
  • Merge two sorted linked list.
  • Re-sort a singly linked list by left part and right part.

How to run

npm i
babel-node --presets env xxx.js