In computer science, asymptotic analysis is the core of complexity analysis. This is premised with the idea that we are interested in knowing how the algorithm scales with an input size that approaches infinity. There’s three main types of notation: big-O, big-omega, and big-theta notation.

-notation refers to the upper bound on an algorithm’s runtime. -notation refers to the lower bound. -notation (which is like a tight upper/lower bound limit), which describes precisely how the algorithm grows. For an informal guide to finding big-O, see the page for time complexity.

Formal definition

We describe the running time of algorithms in terms of functions that maps either from/to the set of natural numbers or the set of reals. represents the bound on the number of operations that an algorithm takes. is the function we’re analysing, which can be more complicated than . The running-time function is denoted . If a function belongs to the set of functions (let’s use big-O), we use a notational abuse to say that .

This figure gives some intuition on where comes into play.1 Essentially the value of must be on or below for values to the right of . We’re only interested in the long-term behaviour.

Big-O

For a given function , we denote as the set of functions:

i.e., belongs to if there exists a positive constant such that . This definition requires that any is asymptotically non-negative, i.e., for sufficiently large , must be non-negative.

We also define little-O , which may not be an asymptotically tight upper bound.

Big-Ω

We denote as the set of functions:

i.e., an asymptotic lower bound.

We also define little-omega , which may not be an asymptotically tight lower bound.

Big-Θ

We denote as the set of functions:

i.e., it was an asymptotically tight bound. By theorem, we have if and only if .

Properties

  • If and , then: .
  • if and only if .
  • if and only if .
  • if and only if .
  • .
  • if and only if .

Then, let and , where the prime denotes an arbitrary function (not the derivative), then:

Footnotes

  1. From CLRS’ Introduction to Algorithms.