Major named algorithms, grouped by problem domain, each solving one well-defined problem. For the full alphabetical list of every named algorithm/theorem/structure mentioned anywhere in the notes (much longer, no grouping), see 🐬 Named Algorithms. For the general strategies these are instances of, see 🐬 Paradigms; for cross-cutting tricks, 🐬 Techniques; for the structures they run on, 🐬 Data Structures.

Sorting

AlgorithmSolvesComplexityNote
Merge sortstable comparison sortSorting
Quicksortin-place comparison sort expectedSorting
Counting / radix sortsort by small-range or fixed-width keys / Sorting

Searching

AlgorithmSolvesComplexityNote
Binary search (and variants)find a boundary in a monotone predicateBinary Search
Ternary / golden-section searchoptimum of a unimodal functionTernary Search

Graph shortest paths

AlgorithmSolvesComplexityNote
Dijkstra’s algorithmsingle-source shortest paths, non-negative weightsShortest Paths
Bellman–Fordsingle-source shortest paths, negative weights, cycle detectionShortest Paths
Floyd–Warshallall-pairs shortest pathsShortest Paths
SPFABellman–Ford with a queue, usually faster, adversarially slow worst caseShortest Paths
Johnson’s algorithmall-pairs shortest paths, negative weights allowedShortest Paths
0-1 BFSshortest paths, weights in Shortest Paths
Suurballe’s algorithmtwo vertex-disjoint shortest pathsShortest Path Techniques
Eppstein’s algorithm shortest pathsK Shortest Paths

Graph structure

AlgorithmSolvesComplexityNote
Kosaraju’s / Tarjan’s SCCstrongly connected componentsSCC and 2-SAT
Tarjan’s bridge/articulation-point algorithmcut edges and cut verticesBridges and Biconnectivity
Kahn’s algorithm / DFS topological sorta topological order of a DAGDAGs and Topological Sort
Hierholzer’s algorithman Eulerian circuit/pathEuler Tours
Lengauer–Tarjandominator treeDominator Tree

Minimum spanning trees

AlgorithmSolvesComplexityNote
Kruskal’s algorithmMST via sorted edges + DSUMinimum Spanning Trees
Prim’s algorithmMST via a growing frontierMinimum Spanning Trees
BorƯvka’s algorithmMST via parallel component-merging roundsMinimum Spanning Trees
Edmonds’ algorithm (Chu–Liu/Edmonds)minimum spanning arborescence (directed)Directed MST

Flows and matching

AlgorithmSolvesComplexityNote
Ford–Fulkerson / Edmonds–Karpmaximum flow (Edmonds–Karp)Max Flow
Dinic’s algorithmmaximum flow, unit-capMax Flow
Push–relabelmaximum flowPush-Relabel
Hopcroft–Karpmaximum bipartite matchingBipartite Matching
Hungarian algorithm (Kuhn–Munkres)minimum-cost perfect bipartite matchingAssignment Problem
Blossom algorithmmaximum matching in a general graphGeneral Matching
Gale–Shapleya stable matchingStable Matching
Stoer–Wagnerglobal minimum cutGlobal Min Cut

Strings

AlgorithmSolvesComplexityNote
Knuth–Morris–Pratt (KMP)single-pattern matching via the prefix functionPrefix Function and Z
Z-algorithmsingle-pattern matching via the Z-functionPrefix Function and Z
Manacher’s algorithmlongest palindromic substring at every centerPalindromes
Aho–Corasickmulti-pattern matching$O(\sump_i
Booth’s algorithmlexicographically minimal rotationString Basics
SA-ISsuffix array constructionSuffix Array
Ukkonen’s algorithmonline suffix tree constructionSuffix Tree

Number theory

AlgorithmSolvesComplexityNote
Extended Euclidean algorithm and Bézout coefficientsGCD and Extended Euclid
Miller–Rabinprobabilistic primality testingPrimality and Factorization
Pollard’s rhointeger factorization expectedPrimality and Factorization
Tonelli–Shanksmodular square rootModular Square Roots
Baby-step giant-step (BSGS)discrete logarithmPrimitive Roots and Discrete Log

Polynomials and transforms

AlgorithmSolvesComplexityNote
Fast Fourier Transform (FFT)polynomial multiplication over FFT
Number Theoretic Transform (NTT)polynomial multiplication mod an NTT-friendly primeNTT
Fast Walsh–Hadamard Transform (FWHT)XOR/AND/OR convolutionConvolution Variants

Computational geometry

AlgorithmSolvesComplexityNote
Andrew’s monotone chainconvex hullConvex Hull
Rotating calipersdiameter/width of a convex polygon, closest pair of parallel lines, etc. after a hullRotating Calipers
Bentley–Ottmannall segment intersectionsSweep Line
Welzl’s algorithmminimum enclosing circle expectedMinimum Enclosing Circle

Combinatorics

AlgorithmSolvesComplexityNote
Burnside’s lemma / Pólya enumerationcounting objects up to symmetryproblem-dependentBurnside and Pólya