A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Algorithm Analysis and Big-O Notation

College Depth 79 in the knowledge graph I know this Set as goal
400topics build on this
410prerequisites beneath it
See this on the map →
Dijkstra's Shortest Path AlgorithmAgent-Based Modeling in Social ScienceAlgorithm Complexity and Big-O Notation+11 more
algorithms complexity big-o

Core Idea

Big-O notation describes asymptotic upper bounds: f(n) ∈ O(g(n)) if f(n) ≤ cg(n) for large n and constant c. It abstracts away constant factors and lower-order terms. Big-Θ and Big-Ω provide tighter and lower bounds respectively.

How It's Best Learned

Start with simple functions like n, n², 2n. Compare growth rates by computing limits and building intuition.

Common Misconceptions

Explainer

When analyzing algorithms, we want to understand how running time grows as the input size n increases — not the exact number of operations, which depends on the hardware, compiler, and implementation details. Big-O notation provides a language for this: we say f(n) ∈ O(g(n)) if there exist constants c and n₀ such that f(n) ≤ c·g(n) for all n ≥ n₀. In plain terms, g(n) is an upper bound on f(n) for large inputs, up to a constant multiplier.

The crucial feature of Big-O is what it deliberately ignores: constant factors and lower-order terms. The function 5n² + 1000n + 7 is O(n²) because for large enough n, the n² term dominates everything else. This simplification is intentional — it focuses attention on the fundamental growth rate, which is what matters when n is very large. The cost is that Big-O cannot compare two O(n²) algorithms; they might differ by a factor of 100 in practice.

Big-O (O) provides only an upper bound. Two companion notations give more precision: Ω(g(n)) is a lower bound — f grows at least as fast as g — and Θ(g(n)) means both, so f grows at exactly the rate g. Most introductory analysis establishes O-bounds (they are easier to prove), but Θ is the more informative statement. When someone says "merge sort runs in O(n log n)", they usually mean Θ(n log n): the best and worst cases both scale as n log n.

A common trap is confusing what Big-O says about an algorithm's speed versus an algorithm's input. O(n²) does not mean "slow for all inputs" — for n = 10, an O(n²) algorithm performs at most 100 operations (scaled by a constant). Asymptotic notation only becomes meaningful as n grows large. For small n, empirical profiling and constant factors matter far more than the Big-O class. Developing judgment about when the asymptotics kick in is part of practical algorithm design.

Practice Questions 3 questions

Prerequisite Chain

Understanding ZeroThe Number ZeroCounting to FiveCounting to 10Counting to 20Counting a Set of Objects Up to 20Cardinality: The Last Number CountedMatching Numerals to QuantitiesSubitizing Small QuantitiesAddition Within 10Number Bonds to 10Addition Within 20Doubles and Near DoublesDoubles Facts Within 10Near Doubles Facts Within 20Mental Math Strategies for AdditionMental Math: Adding and Subtracting TensAddition Within 100Repeated Addition as MultiplicationMultiplication as Equal GroupsMultiplication: ArraysBasic Multiplication Facts (0s, 1s, 2s, 5s, 10s)Multiplication Facts Within 100Division as Equal SharingDivision as Grouping (Measurement Division)Division: Grouping (Repeated Subtraction) ModelDivision: Fair Sharing ModelDivision as Equal SharingDivision as GroupingBasic Division FactsDivision Facts Within 100Multiplication and Division Fact FamiliesRelationship Between Multiplication and DivisionDivision Facts as Inverse of MultiplicationRemainders and Quotients in DivisionDivision Word ProblemsMulti-Step Word ProblemsSolving Multi-Step Word ProblemsMultiplication Word ProblemsDivision Word ProblemsIntroduction to Long DivisionFactors and MultiplesPrime and Composite NumbersEquivalent FractionsRelating Fractions and DecimalsDecimal Place ValueIntegers and the Number LineComparing and Ordering IntegersAbsolute ValueAdding IntegersSubtracting IntegersMultiplying IntegersDividing IntegersUnit RatesProportionsPercent ConceptConverting Between Fractions, Decimals, and PercentsOperations with Rational NumbersTwo-Step EquationsSolving Multi-Step EquationsEquations with Variables on Both SidesLiteral EquationsSlope-Intercept FormPoint-Slope FormWriting Linear EquationsParallel and Perpendicular Line SlopesGraphing Linear EquationsPiecewise FunctionsStep FunctionsComposition of FunctionsInverse FunctionsRadical Functions and GraphsRational ExponentsExponential Functions and GraphsLogarithms IntroductionBig-O Notation and Asymptotic AnalysisBreadth-First Search (BFS)Shortest Paths in Unweighted GraphsDijkstra's Shortest Path AlgorithmAlgorithm Analysis and Big-O Notation

Longest path: 80 steps · 410 total prerequisite topics

Prerequisites (1)

Leads To (13)