Asymptotic Notation

Asymptotic Notation, or Landau Notation

Asymptotic Notation is used to describe the limiting behavior of a function as it approaches a particular value or infinity.

We have already seen a glimpse of this in the last post when we were discussing Order of Growth of functions.  Ex: O(n)

When discussing asymptotic notation, there are three key terms:

  1. Theta Notation - A function that bounds a function within constant factor after a particular n.
  2. Big O Notation - represents the upper bound of Theta-Notation.
  3. Big Omega Notation - represents the lower bound of theta-notation.

In the graph above, (c2 g(n)) represents Big O Notation, because for each n after n0, O(g(n)) >= f(n).  
(c1 g(n)) represents Big Omega Notation because for each n after n0, Omega(g(n)) <=  f(n).
There is an O-notation and Omega-notation, so therefore there exists a Theta-notation for the function f(n).

  1. For O-notation and Omega-notation are both the same function g(n), but differ by some constants c1 and c2.
  2. When discussing the run-time of algorithms in terms of asymptotic notation, we must make sure what exactly we are specifying.  Take for example saying that insertion sort that O(n^2) means that insertion sort runs at n^2 for all input, but rather it will run no slower than O(n^2).  We know that insertion sort does not always run at O(n^2) because we know that in the best-case where the input is already sorted, it will run in Theta(n).
Asymptotically tight - means that the asymptotic notation of a bound is the same factor of n as f(n).  

For Example: 
n^2  = O(n^2)    Is tight
2n = O(n^2)       Is not tight.  2n = o(n^2)

Little-oh Notation - when 0-notation is not asymptotically tight.  o(n).
That means for some constant c, O(cg(n)) >= f(n).  A not asymptotically tight function would be for all constant c, O(cg(n)) > f(n).

w-notation, or little omega notation, is the similar to little-oh notation, but for omega notation.

Comments

Popular posts from this blog

Uncle Bob's Clean Architecture

C4 Model: Describing Software Architecture

Running RabbitMQ with Docker