(This article looks technical, although it is really not. I overuse mathematical symbols if only to exercise a newly found way to display
within HTML. Other people may prefer to discuss asymptotic notation in a much more concrete way.)
According to Donald Knuth, asymptotic notation was invented by Paul Bachmann and popularized by Edmund Landau (both were mathematicians). It is a commonly used method for studying how an algorithm scales with input sizes or input complexity. We will now get some general definitions out of the way.
Since we will be speaking of sets of functions, we will use the set theory notation for these (given with respect to domains and ranges). Suppose we have sets A and B. We define
to be the set of all functions having A as their domain and B as their range. This means that
.
Definition. Consider a real function
. We define the “Big O of eff” as:
.
Definition. Consider a real function
. We define the “Big Omega of eff” as:
.
Definition. Consider a real function
. We define the “Big Theta of eff” as:
.
(CLR prefers Big Theta, but DPV prefers Big O.)
In a way, Big O, Omega, and Theta can be seen as maps from
to the power set
. There also exist the stronger “Small O” and “Small Omega” sets, but we will not be concerned with these.
We defined Big O, Omega, and Theta to be subsets of the set of real functions
. However, we may be concerned with functions other than real functions (perhaps even functions in multiple variables). We can opt for a more general definition of Big O, Omega, and Theta as long as our domain and range have linear orderings. In fact, we are often concerned with sets of functions whose domain is the naturals and whose range is the positive reals, i.e.
. Note that functions with different domains and ranges may not be order-comparable in the way we defined Big O, Omega, and Theta. So we must be careful to maintain the same domain and range for all the functions that we are interested in comparing.
If Big O were defined as a binary relation on the set
, then it would be reflexive, transitive, and antisymmetric (i.e. a partial ordering). Similarly, Big Omega as a binary relation would also be reflexive, transitive, and antisymmetric. Moreover, Big O and Omega are inverse relations since
. If Big Theta were defined as a binary relation, then it would be reflexive, symmetric, and transitive. Therefore, Big Theta forms an equivalence class of functions. Even though both Big O amd Omega relations have the possibility of strict set inclusion (e.g
, this is not possible with Big Theta. Therefore, we have
.
We are generally very lax when dealing with asymptotic notation. For example, it is (more) common to write
instead of
. It is also more common to write the function’s analytical expression within the Big Letter’s parentheses, e.g. if
, then Big Omega of eff may be written as
, which simplifies to
. This abuse of notation is dangerous because there is no way to distinguish a function symbol and an independent variable symbol (just consider taking the Big O of a function such as
). So general conventions restrict independent variables to the letters x, n, and t. If we see one of these letters within the parentheses of Big O, Omega, or Theta then we are dealing with the analytical expression for a function and not the function itself.
References
Cormen, T., Leiserson, C., and Rivest, R. Introduction to Algorithms.
“Big O notation.” Wikipedia http://en.wikipedia.org/wiki/Big_O_notation.