Skip to content

Algorithm Patterns

Tier: 0 (Computational Foundations)

Concepts: 14

Durability: Timeless (algorithms express mathematical relationships between problem structure and computational cost; these relationships predate and outlast any implementation technology)


Fundamental Tensions

Tension Description
Generality vs. Efficiency General-purpose algorithms work on any input but sacrifice constant factors; specialized algorithms exploit problem structure for speed but require assumptions that may not hold. Cannot eliminate because no single algorithm optimally serves all input distributions.
Time vs. Space Faster algorithms often require more memory (caching, precomputation, auxiliary structures); memory-efficient algorithms recompute or scan repeatedly. Fundamental because computation and storage are physically different resources with different costs.
Simplicity vs. Optimality Simple algorithms are easier to implement, verify, and maintain; optimal algorithms often involve complex invariants and edge cases. Exists because optimal solutions exploit structure that simpler approaches ignore.
Deterministic vs. Randomized Deterministic algorithms provide guaranteed worst-case behavior; randomized algorithms achieve better expected performance but introduce variance. Cannot resolve because adversarial inputs can always defeat deterministic strategies, while randomization trades guarantees for probabilistic bounds.
Online vs. Offline Online algorithms must decide with partial information (no future knowledge); offline algorithms see entire input but require batching. Fundamental because information arrives over time in most real systems.

Concepts


Cross-Domain Transfer Summary

This Domain Concept Transfers To
Comparison-Based Sorting Lower Bound Information theory, query complexity, decision theory
Divide and Conquer Parallel computing, distributed systems, database query optimization
Search Space Reduction Database indexing, numerical methods, debugging (bisection), configuration tuning
Graph Traversal Strategies Web crawlers, garbage collection, dependency management, social networks
Shortest Path Problem Structure Network routing, arbitrage detection, project scheduling, game AI
Greedy Strategy Scheduling, compression, resource allocation, approximation algorithms
Dynamic Programming Bioinformatics, NLP, control theory, economics
Backtracking and Pruning Constraint satisfaction, game AI, compiler optimization
Amortized Analysis Database management, garbage collection, network protocols
Randomized Algorithms Cryptography, load balancing, distributed systems, machine learning
Topological Ordering Build systems, compilers, data pipelines, package managers
Minimum Spanning Tree Network design, clustering, image segmentation
Pattern Matching Preprocessing Text processing, bioinformatics, intrusion detection
Approximation and Heuristics Operations research, logistics, ML hyperparameter tuning


Canonical Sources

Source Coverage
Cormen, Leiserson, Rivest, Stein, Introduction to Algorithms (2009) Comprehensive reference covering all major algorithm patterns with rigorous analysis
Kleinberg & Tardos, Algorithm Design (2005) Pattern-focused approach emphasizing technique selection and problem reduction
Knuth, The Art of Computer Programming Vols. 1-3 (1968-1973) Definitive treatment of fundamental algorithms with mathematical rigor
Skiena, The Algorithm Design Manual (2008) Practical algorithm selection with war stories and implementation guidance
Sedgewick & Wayne, Algorithms (2011) Visual, accessible presentation with empirical performance analysis
Bellman, Dynamic Programming (1957) Original treatment of dynamic programming theory and applications
Motwani & Raghavan, Randomized Algorithms (1995) Comprehensive coverage of probabilistic algorithm design
Vazirani, Approximation Algorithms (2001) Systematic treatment of approximation techniques for NP-hard problems
Tarjan, "Depth-First Search and Linear Graph Algorithms" (1972) Foundational paper on graph algorithm design patterns