Introduction
The exact running time of a program depends on the machine, the compiler and the input. To compare algorithms rather than programs, we describe how the running time grows as the input size grows, ignoring constant factors and small inputs. Asymptotic notation is the language for this: it lets us say that merge sort takes " time in the worst case" and mean something precise.
There are five notations: , , , and . Each is a statement about two functions for all sufficiently large . They are used for running time, space, number of comparisons, or any other cost measure, and in any case (worst, best or average).
Throughout, means , and functions are asymptotically non-negative (non-negative for all large ), as running times are.
Prerequisites
- Limits: limits at infinity and L'Hopital's rule, used in the limit test.
- Laws of logarithms and exponents: , .
Core concepts
The five definitions
Let and be functions from the positive integers to the reals. Each notation defines a set of functions, so "" really means . The definitions below are those of CLRS 3e, Section 3.1.
| Notation | Definition | Informal reading |
|---|---|---|
| there exist constants and with for all | grows no faster than (upper bound) | |
| there exist constants and with for all | grows at least as fast as (lower bound) | |
| there exist constants and with for all | grows at the same rate as (tight bound) | |
| for every constant there is an with for all | grows strictly slower than | |
| for every constant there is an with for all | grows strictly faster than |
The difference between and is the quantifier on . For it is enough that some constant works; for every positive constant must work, however small. So but , while .
Theorem (CLRS 3e, Theorem 3.1). if and only if and .

Analogy with comparing numbers
| Functions | Numbers |
|---|---|
The analogy breaks in one place: trichotomy fails. For real numbers exactly one of , , holds. Two functions can be incomparable. Take and
On even , , so . On odd , , so . Neither bound holds.
Properties
For asymptotically positive , , :
- Transitivity (all five): and imply ; likewise for , , , .
- Reflexivity: , , . Never or .
- Symmetry: if and only if .
- Transpose symmetry: , and .
- Strictness: and ; similarly and .
- Sum rule: , because . So lower-order terms can be dropped: .
- Product rule: ; the same holds for and .
- Constant factors: for any constant .
The limit test
If for large and the limit exists (allowing ), then:
| Value of | Conclusion |
|---|---|
| , hence also | |
| , hence also |
For and the test is also necessary: exactly when the limit is 0. For it is only sufficient: is (it lies between and ), yet has no limit. When the limit does not exist, go back to the definitions.
Standard growth rates
For constants , and , each function below is of the next:
where means "is little-o of". The three facts doing the work are:
- Polylogarithms lose to polynomials. for every , , however large and small .
- Polynomials lose to exponentials. for every and .
- Exponentials with different bases differ. For , . So and .
Useful identities and estimates:
- Base of a logarithm does not matter. for any constant . That is why we write without a base. The base of an exponential does matter.
- Exponent of a logarithm. , but is a different, larger class for .
- Swapping base and argument. . For example , and .
- Factorials (Stirling). . Consequences: , and .
- Shifts. for constants and ; ; but .

Worked examples
Example 1: proving a Theta bound with explicit constants
Claim: .
- Lower bound. for all . Take .
- Upper bound. Try : we need , that is . The positive root is , so the inequality holds for every integer and fails at ().
So , , witness the bound. Other choices work too: works from , since for . The constants are not unique; only their existence matters.
Example 2: showing a bound fails
Claim: . Suppose for all . Dividing by gives for all , which is false for . The same argument shows : it would need for all large .
Example 3: ranking functions
Arrange in increasing order of growth: , , , , , , , , .
Rewriting each function, or taking its , is a quick way to compare those that grow faster than any polynomial:
| Function | Rewrite or logarithm | Class |
|---|---|---|
| polylogarithmic | ||
| polynomial, degree | ||
| and | by Stirling | (same class) |
| polynomial, degree | ||
| quasi-polynomial | ||
| exponential | ||
| exponential, larger base | ||
| factorial |
Answer: , where means of each other.
Two cautions about the log trick:
- If and , then . This settles versus : .
- If only , nothing follows: , yet . Similarly and are of each other, but . Compare the functions themselves in such cases.
Note also that beats only for very large : at , while . Asymptotic order says nothing about where the crossover occurs.
Example 4: disguised functions
Several functions look exotic but become simple once written as a power of 2. Put , so :
| Function | As a power of 2 | Class |
|---|---|---|
| , the constant 2 | ||
| faster than every polylog, slower than every | ||
| equal to : superpolynomial, subexponential | ||
| , so but |
The third row is the one to watch. Against a polylog , the exponent beats ; against , the exponent beats . Since the exponent differences tend to infinity, the log trick applies in both directions. Crossovers can be far out: fails for every integer from 2 to 20,519 and holds from on, so overtakes only beyond .
The last row matters for Strassen's : , so "" is a correct upper bound and "" is false.
Notation versus cases
Asymptotic notation and the case of analysis are independent choices.
- The case fixes a function: the worst-case running time is the maximum over inputs of size ; the best case is the minimum; the average case is an expectation under a stated input distribution.
- The notation then bounds that function.
So "the worst case of insertion sort is " and "the best case of insertion sort is " are both precise. "The running time of insertion sort", with no case, is not a single function; the strongest correct statements about it are and . It is not on every input.
Common misreadings to avoid:
- " means worst case and means best case." False. A worst case can have a lower bound (the worst case of merge sort is ), and a best case can have an upper bound.
- " means the algorithm takes about steps." False. is only an upper bound; a algorithm is also . Use when the bound is tight.
- In an equation such as , the stands for some anonymous function in that set.
Important properties and observations
- does not imply . Counterexample: , ; then .
- does not imply : but .
- fails when , for example . It holds when for large .
- holds for polynomials ( versus ) but fails for , since .
- .
- Asymptotic order is about large only. An algorithm with cost is yet slower than one with cost for every .
- For polynomials: when .
GATE examination perspective
- True/false statements on pairs of functions. For each pair, decide which of , , , , hold, using the limit test where the limit exists and the definitions otherwise.
- Ranking functions by growth rate. Rewrite each function as a power of 2 or of , compare logarithms with the cautions above, and remember and .
- Traps. Bases of exponentials matter ( versus ); bases of logarithms do not. is but is not for fixed , . is superpolynomial but subexponential. A function can be in neither nor . lies strictly between polylogarithmic and polynomial.
- Disguised constants and powers. ; ; . Convert to a power of 2 before comparing.
- Precision of language. A statement can turn on versus and on which case (worst or best) is meant. Read both.
Summary
Sources
- T. H. Cormen, C. E. Leiserson, R. L. Rivest, C. Stein, Introduction to Algorithms, 3rd ed., MIT Press, 2009: Chapter 3 "Growth of Functions" (Section 3.1 asymptotic notation and Theorem 3.1; Section 3.2 standard notations, logarithms, factorials and Stirling's approximation).
- GATE 2027 Computer Science and Information Technology syllabus, IIT Madras, Section 5 "Algorithms": (consulted 2026-11-09).