Classic algorithms and data structures implemented in JavaScript, you know... FOR SCIENCE.
npm install --save algorithms
require('algorithms/data_structures');
// or
require('algorithms').DataStructures;
- AVLTree
- BST
- DisjointSetForest
- FenwickTree
- Graph
- HashTable
- Heap
- MaxHeap
- MinHeap
- LinkedList
- PriorityQueue
- Queue
- Set (HashSet)
- Stack
- Treap
require('algorithms/geometry');
// or
require('algorithms').Geometry;
- BezierCurve
require('algorithms/graph');
// or
require('algorithms').Graph;
- breadthFirstSearch
- depthFirstSearch
- eulerPath
- topologicalSort
- bellmanFord
- bfsShortestPath
- dijkstra
- floydWarshall
- SPFA (Shortest Path Faster Algorithm)
- prim
- kruskal
require('algorithms/math');
// or
require('algorithms').Math;
- collatzConjecture
- extendedEuclidean
- fastPower
- fibonacci
- findDivisors
- fisherYates
- gcd (Greatest common divisor)
- greatestDifference
- lcm (Least common multiple)
- newtonSqrt
- nextPermutation
- powerSet
- reservoirSampling
- 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)
- postOrder
- preOrder
require('algorithms/sorting');
// or
require('algorithms').Sorting;
- bubbleSort
- countingSort
- heapSort
- insertionSort
- quicksort
- radixSort
- selectionSort
- shellSort
- shortBubbleSort
require('algorithms/string');
// or
require('algorithms').String;
- hamming
- huffman
- decode
- encode
- knuthMorrisPratt
- levenshtein
- longestCommonSubsequence
- longestCommonSubstring
- rabinKarp
This project uses Google JavaScript Style Guide which can be a bit strict, but is really helpful in order to have more readable and less error-prone code