Learning path

Analysis of algorithms

Measure how running time and memory grow, solve recurrences, reason about average and amortized cost, and prove a loop correct.

About this subject

Analysis of algorithms asks two questions about a procedure: is it correct, and how do its time and memory grow as the input gets larger? Instead of timing one run on one computer, you count operations and compare growth rates with asymptotic notation: O for an upper bound, Ω for a lower bound, and Θ for a tight bound.

This path covers growth rates, recurrences and the master theorem, amortized analysis, best, worst, and average cases, loop invariants for correctness, and the trade-off between time and memory. Each lesson uses a small, complete program that runs on its own. Python has the full sequence. The other languages listed below add lessons that use that language's own idioms and standard library, such as Java threads, C++ smart pointers, C# LINQ, or Node.js streams, and appear only for the topics the language supports. The programs are simplified models chosen to make an idea visible, so they are a foundation for further study rather than a replacement for a full course or for production-grade software.

Before you start: Programming fundamentals and the complexity lesson in data structures and algorithms.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7