Skip to content

Complexity Notation

The notations we use to describe the asymptotic running time of an algorithm are defined in terms of functions whose domains are the set of natural number N, which means we are only analyzing cases where the input size n1 as we are dealing with space and time. Furthermore, since we deal with asymptotic notation we need to discard the constants.

O(n) - Upper limit

Let f(n)0,g(n)0 be two functions

If there exists a constant c>0, such that for n sufficiently large, f(n)cg(n)

O(g(n))={f(n)|c>0,noNnno:f(n)cg(n)}

Basically we are saying that the function f(n) can be even greater than g(n), but only before reaching the point no. After that, the function f(n)cg(n).

Ω(n) - Lower limit

Let f(n)0,g(n)0 be two functions

O(g(n))={f(n)|c>0,noNnno:f(n)cg(n)}

Θ(n)

Let f(n)0,g(n)0 be two functions

O(g(n))={f(n)|c1>0,c2>0,noNnno:c1g(n)f(n)c2g(n)}f(n)=Θ(g(n))f(n)=O(g(n))Ω(g(n))

o(n)

o(g(n))={f(n)|c>0,noNnno:f(n)<cg(n)}

ω(n)

ω(g(n))={f(n)|c>0,noNnno:f(n)>cg(n)}

Hierarchy of notations

  • o(g(n))O(g(n))
  • o(g(n))Ω(g(n))=
  • ω(g(n))Ω(g(n))
  • ω(g(n))O(g(n))=

Using summations and limits to define asymptotic complexity

Bounding converging summations

Bounding diverging summations

Comparing limits

Finding the dominant complexity