What Big O actually states
Here f and g are eventually nonnegative cost functions, and n is a discrete input size. The constants c and n0 may depend on the algorithm, but not on the particular n.[1]
Specify input size and the operation counted. For a list, n may be the number of elements; for an integer, it may be its bit length. A numerical value and its representation length are therefore different inputs to an analysis. O(g) is a set of functions; the common notation f(n) = O(g(n)) denotes membership rather than ordinary equality.[2][1]
Theta also requires a matching lower bound. An upper bound need not be tight: a linear function also belongs to O(n2).[2]
Prove bounds and count loops
For polynomials with nonnegative coefficients, each lower-power term is bounded by the highest power once n ≥ 1. Constant factors remain part of the actual work; the bound absorbs them into c. Changing between fixed logarithm bases greater than one likewise changes only a constant factor in n·log n. A finite plot illustrates growth but does not prove a statement for every n beyond n0.[2]
Sequential loops add their costs. Nested loops require an actual count: an inner loop with i iterations produces a sum rather than automatically n·n. Also distinguish whether the resulting cost function is a best case, an expectation or a worst case. An expected-cost analysis additionally needs a probability model. Compare sorting algorithms and binary search as concrete cases.[2]
Two worked examples
Bound a polynomial using fixed constants
- Given
- f(n)=3n2+7n+4 for integer n≥1, counting operations.
- Find
- Show f∈Θ(n2), rather than only O(n2).
For n≥1, both n≤n2 and 1≤n2 hold.
The additional terms are nonnegative, giving a lower bound too.
Result: The choices c=14 and n0=1 prove the upper bound; the lower factor 3 makes it asymptotically tight.
Check: At n=4, f=80 lies between 48 and 224. This checks the arithmetic; the inequalities establish the general statement.
Count a triangular loop
- Given
- The outer loop runs through i=1,…,n; the inner loop executes exactly i constant-cost operations.
- Find
- Find the total count and its growth class.
Add the actual inner-loop iterations.
For n≥1, n+1 lies between n and 2n.
Result: C∈Θ(n2); at n=8 there are 36 operations, rather than 64.
Check: The sum 1+2+3+4+5+6+7+8 equals 36. A quadratic class is not an exact count of n2.
Recall the method later with the formula’s flashcards.
10 flashcards · English materials
Already have an account? Sign in for flashcardsAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Five exercises with solutions
Calculate · Foundation
Find a tight growth class for 8n3+2n2+9, n≥1.
Show hint
Bound lower powers by n3.
Learning goal: Justify fixed bounds instead of merely dropping terms.
Rearrange · Application
Two exact count models are A(n)=n2 and B(n)=20n. For which positive integer sizes is B smaller?
Show hint
Divide the strict inequality by positive n.
Learning goal: Separate exact comparisons from asymptotic statements.
Show solution and calculation
20n<n2 means n>20, hence n≥21.
At 20 both counts equal 400.
This crossover belongs to the exact models, not to O(n) and O(n2) alone.
Interpret · Foundation
Is 3n+4∈O(n2) true? Is O(n2) its tightest usual polynomial class?
Show hint
A valid upper bound may be loose.
Learning goal: Distinguish an upper bound from a tight bound.
Show solution and calculation
Yes: for n≥1,3n+4≤7n≤7n2.
Its tight class is Θ(n), because 3n≤3n+4 also holds.
Error analysis · Application
Someone writes: “O(n) means worst case and Ω(n) means best case.” What is wrong?
Show hint
Input case and kind of bound are separate choices.
Learning goal: Resolve the common confusion between these two distinctions.
Show solution and calculation
O is an upper bound and Ω a lower bound on an already specified function.
Both best-case and worst-case functions can have upper and lower bounds.
Neither notation specifies an input distribution.
Transfer · Challenge
A list is scanned once; then every one of its n elements is compared with all n elements. Each operation has constant cost. Find a tight class.
Show hint
Count n plus n2 rather than multiplying the phases.
Learning goal: Build costs from the actual control flow.
Show solution and calculation
C=n+n2.
For n≥1, n2≤C≤2n2, giving Θ(n2).
Two sequential n-loops would instead give 2n and Θ(n).
Check your understanding with the formula’s reference test.
7 test questions · English materials
Already have an account? Sign in for the testAvailable from Essential. A ready-made formula set, no AI credits required. Article exercises are not all included.
Limits of the statement
The growth class applies within the chosen computation model. Caching, parallelism, input structure and large constant factors can dominate on finite data. Counting n operations also need not mean linear work in the bit length of the numbers represented. Practical selection therefore combines correctness, memory requirements and measurements on representative data; Big O alone is not a speed benchmark.[1][2]
Sources for this explanation
Quanta · Updated November 8, 2026
- NIST Dictionary of Algorithms and Data Structures: big-O notation
- Freie Universität Berlin: asymptotic bounds and O notation (translated source label)
Editorial responsibility: Quanta Study editorial team
Review scope
This explanation, 2 worked examples and 5 exercises are available in German and English. Structure, source references and mathematical notation undergo automated checks. Calculations, model assumptions and both language versions receive a separate AI review.
An independent, named human subject review has not yet been documented. Our exercise numbers are worked examples, rather than measurements published by the cited sources.
Editorial responsibility, sources and methodsChange history
- Added a DE/EN article with bound proofs, exact loop counts, worked examples and exercises.
Cite this reference page
Quanta. Big-O notation (asymptotic upper bound). Updated November 8, 2026. https://quanta-study.de/en/formula-sheet/big-o-notation
When citing a specific scientific statement, also cite the specialist source linked to that statement.