It was first introduced by Germannumber theoristPaul Bachmann in his 1892 book Analytische Zahlentheorie. The notation was popularized in the work of another Germannumber theoristEdmund Landau,
hence it is sometimes called a Landau symbol. The
O was originally a capital omicron; today the capital letter O is used, but never the digit
zero.
In Wikipedia, the various notations described in this article, including Omega notation and Theta notation are used
for approximating formulas (e.g. those in the sum article), for
analysis of algorithms (e.g. those in the heapsort article),
and for the definitions of terms in
complexity theory
(e.g. polynomial time).
As n grows large, the n2 term will come to
dominate, so that all other terms can be neglected. Further, the
constants will depend on the precise details of the implementation and
the hardware it runs on, so they should also be neglected. Big O
notation captures what remains: we write
and say that the algorithm has order of n2 time complexity.
there exists numbers x0 and M such that |f(x)| ≤ M |g(x)| for x > x0.
The notation can also be used to describe the behavior of f near
some real number a: we say
f(x) is O(g(x)) as x → a
if and only if
there exists numbers δ>0 and M such that |f(x)| ≤ M |g(x)| for |x - x0| < δ.
If g(x) is non-zero for values of x sufficiently close to a, both of these definitions can be unified using the limit superior:
f(x) is O(g(x)) as x → a
if and only if
In mathematics, both asymptotic behaviors near ∞ and near a are considered.
In computational complexity theory, only asymptotics near ∞ are used; furthermore,
only positive functions are considered, so the absolute value bars may
be left out.
O(log n) is exactly the same as O(log(nc)).
The logarithms differ only by a constant factor, (since
log(nc)=c log n) and thus the big O
notation ignores that. Similarly, logs with different constant bases
are equivalent.
If a function f(x) may be bounded by a polynomial in x, then as x tends to zero, one may disregard higher-order terms of the polynomial. Notice the distinction with the case of infinite asymptotics.
asymptotically tight bound (iff both f(n) = O(g(n)) and g(n) = O(f(n)))
Here is a hint (and mnemonics) why Landau selected these Greek letters: "omicron" is "o-micron", i.e., "o-small", whereas "omega" is "o-BIG".
The relation f(n) = o(g(n)) is read as "f(n) is little-oh of g(n)". Intuitively, it means that g(n) grows much faster than f(n). Formally, it states that the limit of f(n)/g(n) is zero.
The notations Θ and Ω are often used in computer science;
the lower-case o is common in mathematics but rare in computer
science. The lower-case ω is rarely used.
In casual use, O is commonly used where Θ is meant, i.e., a tight estimate is implied.
For example, one might say "heapsort is O(n log n) in
average case" when the intended meaning was "heapsort is
Θ(n log n) in average case". Both statements are true,
but the latter is a stronger claim.
Another notation sometimes used in computer science is Õ (read
Soft-O). f(n) = Õ(g(n)) is shorthand
for f(n) = O(g(n) logkn) for some
k. Essentially, it is Big-O, ignoring logarithmic factors.
This notation is often used to describe a class of "nitpicking" estimates (since logkn is always o(n) for any constant k).