← All chapters
Chapter 02Weeks 2–3Phase 1 ~3.4 h
Algorithm & Algorithm Analysis
Properties of algorithms, counting time units, best/average/worst case and asymptotic notation.
- 2.1Algorithms & Their PropertiesAn algorithm is a finite, unambiguous sequence of steps that solves a problem. Learn the 11 properties every correct algorithm must have. 30 mineasy
- 2.2Measuring EfficiencyEmpirical vs theoretical analysis, qualitative vs quantitative, the three classic avoidable inefficiencies, and the time–space trade-off. 35 mineasy
- 2.3Counting Time UnitsTurn code into a formula T(n) using the instructor's counting rules. Loops become sums, and nested loops multiply. 50 minmedium
- 2.4Best, Average & Worst CaseThe same algorithm can be fast or slow depending on the input. We analyse the best, average and worst case, and usually report the worst. 30 mineasy
- 2.5Asymptotic Notation & Big-O ProofsO, Ω, Θ, o and ω describe how fast T(n) grows for large n. Learn the definitions, the order of growth, and how to prove f(n) = O(g(n)) by finding c and k. 60 minmedium