algorithms.js

Atwood's Law applied to CS101 - Classic algorithms and data structures implemented in JavaScript

Github stars Tracking Chart

algorithms.js

Build Status
Coverage Status
Dependency Status
devDependency Status
Inline docs
npm

Atwood's Law applied to CS101.

Classic algorithms and data structures implemented in JavaScript, you know... FOR SCIENCE.

Installing

npm install --save algorithms

Contents

Data Structures

require('algorithms/data_structures');
// or
require('algorithms').DataStructures;
  • AVLTree
  • BST
  • DisjointSetForest
  • FenwickTree
  • Graph
  • HashTable
  • Heap
    • MaxHeap
    • MinHeap
  • LinkedList
  • PriorityQueue
  • Queue
  • Set (HashSet)
  • Stack
  • Treap

Geometry algorithms

require('algorithms/geometry');
// or
require('algorithms').Geometry;
  • BezierCurve

Graph algorithms

require('algorithms/graph');
// or
require('algorithms').Graph;
  • breadthFirstSearch
  • depthFirstSearch
  • eulerPath
  • topologicalSort
Shortest path
  • bellmanFord
  • bfsShortestPath
  • dijkstra
  • floydWarshall
  • SPFA (Shortest Path Faster Algorithm)
Minimum spanning tree
  • prim
  • kruskal

Math algorithms

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

Search algorithms

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

Sorting algorithms

require('algorithms/sorting');
// or
require('algorithms').Sorting;
  • bubbleSort
  • countingSort
  • heapSort
  • insertionSort
  • quicksort
  • radixSort
  • selectionSort
  • shellSort
  • shortBubbleSort

String algorithms

require('algorithms/string');
// or
require('algorithms').String;
  • hamming
  • huffman
  • decode
  • encode
  • knuthMorrisPratt
  • levenshtein
  • longestCommonSubsequence
  • longestCommonSubstring
  • rabinKarp

Contributing

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

Main metrics

Overview
Name With Ownerfelipernb/algorithms.js
Primary LanguageJavaScript
Program languageMakefile (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2014-02-10 00:04:28
Pushed At2022-05-22 20:03:10
Last Commit At2019-02-19 08:35:22
Release Count16
Last Release Namev0.10.0 (Posted on 2016-05-04 16:00:40)
First Release Namev0.1.0 (Posted on )
用户参与
Stargazers Count3.7k
Watchers Count135
Fork Count409
Commits Count419
Has Issues Enabled
Issues Count49
Issue Open Count5
Pull Requests Count72
Pull Requests Open Count6
Pull Requests Close Count13
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private