Master Index of Algorithms

Academic Scope & Specification: A rigorous computational taxonomy and algorithmic reference synthesized according to top-tier university curricula (MIT 6.006/6.046, UC Berkeley CS 170, CMU 15-451). Spans 11 foundational domains featuring exact asymptotic complexities (Best, Worst, Average, Auxiliary Space), algorithmic design paradigms, formal state invariants, and practical systems implementations.


🏛️ Algorithmic Design Paradigms

Before analyzing specific algorithms, computer scientists classify algorithms by their underlying design strategy:

  1. Divide-and-Conquer: Break the problem into non-overlapping subproblems of the same type, solve them recursively, and combine solutions (e.g., MergeSort, Fast Fourier Transform, Strassen's Matrix Multiplication). Governed by the Master Theorem: $T(n) = aT(n/b) + O(n^d)$.
  2. Greedy Strategy: Construct a solution incrementally by choosing the locally optimal choice at each step without backtracking (e.g., Dijkstra, Kruskal, Prim, Huffman Coding). Requires proving the Greedy-Choice Property and Optimal Substructure.
  3. Dynamic Programming (DP): Solve optimization problems exhibiting overlapping subproblems and optimal substructure by caching intermediate subproblem solutions via memoization (top-down) or tabulation (bottom-up) (e.g., Knapsack, Bellman-Ford, Floyd-Warshall).
  4. Reduction & Transform-and-Conquer: Transform a problem into an instance of a known solved problem (e.g., Bipartite Matching reduced to Max Flow, 3-SAT reductions).
  5. Randomization & Probabilistic Analysis: Utilize pseudo-random choices to guarantee expected polynomial runtime or sublinear space bounds (e.g., Randomized QuickSort, Miller-Rabin, HyperLogLog).
  6. Branch-and-Bound / Pruning: Systematically enumerate candidate solutions along a search tree while pruning unpromising subtrees (e.g., A Search, Alpha-Beta Pruning, Traveling Salesperson exact solver)*.

1. Sorting & Searching (The Foundations)

Comparative and non-comparative ordering, in-place partitioning, and retrieval complexity.

📊 Sorting Complexity Matrix

Algorithm Best Time Average Time Worst Time Space (Aux) Stable? Design Paradigm
Binary Search O(1) O(log n) O(log n) O(1) N/A Divide & Conquer / Decrease
MergeSort O(n log n) O(n log n) O(n log n) O(n) Yes Divide & Conquer
QuickSort (Randomized) O(n log n) O(n log n) O(n²) O(log n) No Divide & Conquer / Partitioning
HeapSort O(n log n) O(n log n) O(n log n) O(1) No Selection / Binary Heap
Insertion Sort O(n) O(n²) O(n²) O(1) Yes Incremental Insertion
Counting Sort O(n + k) O(n + k) O(n + k) O(k) Yes Non-Comparative / Direct Indexing
Radix Sort (LSD) O(nk) O(nk) O(nk) O(n + k) Yes Non-Comparative / Positional Digit
Timsort (Python / Java) O(n) O(n log n) O(n log n) O(n) Yes Hybrid (MergeSort + Insertion Sort)

2. Graph & Network Algorithms (Routing & Relationships)

Pathfinding, minimum spanning trees, cycle detection, and flow networks across directed/undirected graphs.

📊 Graph Algorithms Complexity Matrix

Algorithm Primary Objective Time Complexity Space Complexity Negative Edges? Design Paradigm
Breadth-First Search (BFS) Shortest Path (Unweighted) O(V + E) O(V) N/A (Unweighted) Queue Traversal
Depth-First Search (DFS) Topological Sort, Cycles, SCC O(V + E) O(V) N/A Recursive Stack Traversal
Dijkstra (Min-Heap) Single-Source Shortest Path (SSSP) O((V + E) log V) O(V) ❌ No (Non-negative only) Greedy + Priority Queue
A* (A-Star) Search Heuristic Shortest Path O(E) (Best) – O(bᵈ) O(V) ❌ No Best-First / Heuristic Search
Bellman-Ford SSSP + Negative Cycle Detection O(V · E) O(V) ✅ Yes Dynamic Programming
Floyd-Warshall All-Pairs Shortest Path (APSP) O(V³) O(V²) ✅ Yes (No neg cycles) Dynamic Programming
Kruskal’s Algorithm Minimum Spanning Tree (MST) O(E log E) O(V) ✅ Yes Greedy + Disjoint Set (DSU)
Prim’s Algorithm Minimum Spanning Tree (MST) O((V + E) log V) O(V) ✅ Yes Greedy + Priority Queue
Tarjan’s SCC Strongly Connected Components O(V + E) O(V) N/A (Directed) Single-Pass DFS + Low-Link
Edmonds-Karp (Max Flow) Maximum Network Flow O(V · E²) O(V + E) N/A (Capacities $\ge 0$) Augmenting Paths via BFS

3. Dynamic Programming (Optimization & Memory)

Decomposing NP-hard or combinatorial search spaces into overlapping subproblems with optimal substructure.

📊 Canonical Dynamic Programming Formulations

Problem State Definition Time Complexity Space Complexity Real-World Application
0/1 Knapsack DP[i, w] = max value using first $i$ items with capacity $w$ O(n · W) (Pseudo-poly) O(W) (Optimized) Resource allocation, portfolio budgeting
Longest Common Subsequence (LCS) DP[i, j] = LCS length between $X[1..i]$ and $Y[1..j]$ O(n · m) O(min(n, m)) git diff, file patching, DNA sequence alignment
Levenshtein Distance DP[i, j] = edit distance between $S[1..i]$ and $T[1..j]$ O(n · m) O(min(n, m)) Fuzzy search, OCR correction, spellchecking
Matrix Chain Multiplication DP[i, j] = min scalar multiplications to multiply $A_i \dots A_j$ O(n³) O(n²) Query planning, graphics rendering pipelines
Kadane’s Algorithm max_ending_here = max(A[i], max_ending_here + A[i]) O(n) O(1) Max subarray analysis, financial trading window

4. String Processing, Parsing, & Compression

Exact substring searching, multi-pattern dictionary automata, and entropy encoding.


5. Mathematics, Number Theory, & Transforms

Modular arithmetic, prime generation, discrete transforms, and randomized verification.


6. Computational Geometry & Spatial Indexing

Planar boundary calculation, convex hulls, intersection detection, and spatial partitioning.


7. Cryptography & Security

Mathematical algorithms enforcing confidentiality, data integrity, and key agreements.


8. Big Data, Hashing, & Streaming Algorithms

Sublinear space approximations, probabilistic counting, distributed map-reduce, and vector retrieval.


9. Machine Learning, AI, & Meta-Heuristics

Continuous optimization, gradient calculus, clustering, game theory, and evolutionary search.


10. Distributed Systems & Consensus

Fault tolerance, state replication, Byzantine agreement, and decentralized ledgers.


11. Quantum Algorithms & Computational Complexity

Exploiting quantum superposition and entanglement to solve classically intractable problems.