Classic algorithms and data structures implemented in JavaScript, you know... FOR SCIENCE.
npm install --save algorithms
require('algorithms/data_structures');
// or
require('algorithms').DataStructures;
- BST
- Graph
- HashTable
- Heap
- MinHeap
- MaxHeap
- LinkedList
- PriorityQueue
- Queue
- Stack
- Set (HashSet)
- DisjointSetForest
- FenwickTree
require('algorithms/graph');
// or
require('algorithms').Graph;
- topologicalSort
- eulerPath
- depthFirstSearch
- breadthFirstSearch
- bfsShortestPath
- dijkstra
- SPFA (Shortest Path Faster Algorithm)
- bellmanFord
- floydWarshall
- prim
- kruskal
require('algorithms/math');
// or
require('algorithms').Math;
- fibonacci
- fisherYates
- gcd (Greatest common divisor)
- extendedEuclidean
- newtonSqrt
- reservoirSampling
- fastPower
- nextPermutation
- powerSet
- shannonEntropy
require('algorithms/search');
// or
require('algorithms').Search;
- bfs (breadth-first search for binary trees)
- binarySearch
- dfs (depth-first search for binary trees)
- inOrder (default)
- preOrder
- postOrder
require('algorithms/sorting');
// or
require('algorithms').Sorting;
- bubbleSort
- countingSort
- heapSort
- quicksort
- selectionSort
- radixSort
- insertionSort
- shellSort
require('algorithms/string');
// or
require('algorithms').String;
- levenshtein
- rabinKarp
- knuthMorrisPratt
- huffman
- encode
- decode
- hamming
- longestCommonSubsequence
- longestCommonSubstring