All Topics  
Big O notation

 

   Email Print
   Bookmark   Link






 

Big O notation



 
 
In mathematics, big O notation describes the limiting behavior
Asymptotic analysis

In pure mathematics and applied mathematics, particularly the analysis of algorithms, real analysis, and engineering, asymptotic analysis is a method of describing Limit ing behaviour....
 of a function
Function (mathematics)

The mathematical concept of a function expresses dependence between two quantities, one of which is known and the other which is produced. A function associates a single output to each input element drawn from a fixed Set , such as the real numbers , although different inputs may have the same output....
 when the argument tends towards a particular value or infinity, usually in terms of simpler functions. It is also called Big Oh notation, Landau notation, Bachmann–Landau notation, and asymptotic notation. There are also other symbols o, O, ?, and T for related bounds.

Although developed as a part of pure mathematics
Pure mathematics

Broadly speaking, pure mathematics is mathematics motivated entirely for reasons other than application. It is distinguished by its Rigour#Mathematical_rigour, abstraction and mathematical beauty....
, it is now frequently also used in computational complexity theory
Computational complexity theory

Computational complexity theory, as a branch of the theory of computation in computer science, investigates the problems related to the Computational resource required for the execution of algorithms , and the inherent difficulty in providing efficient algorithms for specific computational problems....
 to describe an algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
's usage of computational resources
Computational resource

In computational complexity theory, a computational resource is a resource used by some computational models in the solution of computational problems....
 (usually running time
DTIME

In computational complexity theory, DTIME is the computational resource of computation time for a deterministic Turing machine. It represents the amount of time that a "normal" physical computer would take to solve a certain computational problem using a certain algorithm....
 or memory) with respect to the size
File size

File size measures the size of a computer computer file. Typically it is measured in bytes with a prefix. The actual amount of Computer data storage consumed by the file depends on the file system....
 of the input data.






Discussion
Ask a question about 'Big O notation'
Start a new discussion about 'Big O notation'
Answer questions from other users
Full Discussion Forum



Recent Posts









Encyclopedia


In mathematics, big O notation describes the limiting behavior
Asymptotic analysis

In pure mathematics and applied mathematics, particularly the analysis of algorithms, real analysis, and engineering, asymptotic analysis is a method of describing Limit ing behaviour....
 of a function
Function (mathematics)

The mathematical concept of a function expresses dependence between two quantities, one of which is known and the other which is produced. A function associates a single output to each input element drawn from a fixed Set , such as the real numbers , although different inputs may have the same output....
 when the argument tends towards a particular value or infinity, usually in terms of simpler functions. It is also called Big Oh notation, Landau notation, Bachmann–Landau notation, and asymptotic notation. There are also other symbols o, O, ?, and T for related bounds.

Although developed as a part of pure mathematics
Pure mathematics

Broadly speaking, pure mathematics is mathematics motivated entirely for reasons other than application. It is distinguished by its Rigour#Mathematical_rigour, abstraction and mathematical beauty....
, it is now frequently also used in computational complexity theory
Computational complexity theory

Computational complexity theory, as a branch of the theory of computation in computer science, investigates the problems related to the Computational resource required for the execution of algorithms , and the inherent difficulty in providing efficient algorithms for specific computational problems....
 to describe an algorithm
Algorithm

In mathematics, computing, linguistics and related subjects, an algorithm is a sequence of finite instructions, often used for calculation and data processing....
's usage of computational resources
Computational resource

In computational complexity theory, a computational resource is a resource used by some computational models in the solution of computational problems....
 (usually running time
DTIME

In computational complexity theory, DTIME is the computational resource of computation time for a deterministic Turing machine. It represents the amount of time that a "normal" physical computer would take to solve a certain computational problem using a certain algorithm....
 or memory) with respect to the size
File size

File size measures the size of a computer computer file. Typically it is measured in bytes with a prefix. The actual amount of Computer data storage consumed by the file depends on the file system....
 of the input data. It is also used in many other fields to provide similar estimates.

Formal definition

Suppose and are two functions defined on some subset of the real number
Real number

In mathematics, the real numbers may be described informally in several different ways. The real numbers include both rational numbers, such as 42 and −23/129, and irrational numbers, such as pi and the square root of two; or, a real number can be given by an infinite decimal representation, such as 2.4871773339...., where the digits co...
s. We say if and only if
If and only if

If and only if, in logic and fields that rely on it such as mathematics and philosophy, is a biconditional logical connective between statements....
 there exists a positive real number M and a real number such that

The notation can also be used to describe the behavior of f near some real number a: we say if and only if there exist positive numbers d and M such that

If is non-zero for values of x sufficiently close
Mathematical jargon

The language of mathematics has a vast vocabulary of specialist and technical terms. It also has a certain amount of jargon: commonly used phrases which are part of the culture of mathematics, rather than of the subject....
 to a, both of these definitions can be unified using the limit superior: if and only if

History

The notation was first introduced by number theorist Paul Bachmann
Paul Bachmann

Paul Gustav Heinrich Bachmann was a Germany mathematician.Bachmann studied mathematics at the University of his native city of Berlin andreceived his doctorate in 1862 for his thesis on group theory....
 in 1894, in the second volume of his book Analytische Zahlentheorie ("analytic number theory
Analytic number theory

In mathematics, analytic number theory is a branch of number theory that uses methods from mathematical analysis to solve number-theoretical problems....
"), the first volume of which (not yet containing big O notation) was published in 1892. The notation was popularized in the work of a number theorist Edmund Landau
Edmund Landau

Edmund Georg Hermann Landau was a Germany Jewish mathematician and author of over 250 papers on number theory.Edmund Landau was born in Berlin to a wealthy Jewish family....
; hence it is sometimes called a Landau symbol. It was popularized in computer science by Donald Knuth
Donald Knuth

Donald Ervin Knuth is a renowned computer science and Emeritus of the Art of Computer Programming at Stanford University.Author of the seminal multi-volume work The Art of Computer Programming , Knuth has been called the "father" of the run-time analysis, contributing to the development of, and systematizing formal mathematical techn...
, who (re)introduced the related Omega and Theta notations. The big-O, standing for "order of", was originally a capital omicron
Omicron

Omicron is the 15th letter of the Greek alphabet. In the system of Greek numerals it has a value of 70. It is rarely used in mathematics because it is indistinguishable from the Latin alphabet letter O and easily confused with the Numerical digit 0 ....
; today the identical-looking Latin capital letter O
O

O is the fifteenth letter of the modern Latin alphabet. Its name in English language is spelled o , plural oes ....
 is also used, but never the digit zero
0 (number)

0 is both a number and the numerical digit used to represent that number in numeral system. It plays a central role in mathematics as the additive identity of the integers, real numbers, and many other algebraic structures....
.

Usage

Big O notation has two main areas of application. In mathematics
Mathematics

Mathematics is the study of quantity, structure, space, change, and related topics of pattern and form. Mathematicians seek out patterns whether found in numbers, space, natural science, computers, imaginary abstractions, or elsewhere....
, it is commonly used to describe how closely a finite series
Evaluating sums

In mathematics, a series is the sum of the elements of a sequence. This article mentions a few common series and how to compute their values ....
 approximates a given function, especially in the case of a truncated Taylor series
Taylor series

In mathematics, the Taylor series is a representation of a function as an Series of terms calculated from the values of its derivatives at a single point....
 or asymptotic expansion
Asymptotic expansion

In mathematics an asymptotic expansion, asymptotic series or Poincar? expansion is a formal series of functions which has the property that truncating the series after a finite number of terms provides an approximation to a given function as the argument of the function tends towards a particular, often infinite, point....
. In computer science
Computer science

Computer science is the study of the theoretical foundations of information and computation, and of practical techniques for their implementation and application in computer systems....
, it is useful in the analysis of algorithms
Analysis of algorithms

To analyze an algorithm is to determine the amount of resources necessary to execute it. Most algorithms are designed to work with inputs of arbitrary length....
. In both applications, the function g(x) appearing within the O(...) is typically chosen to be as simple as possible, omitting constant factors and lower order terms.

There are two formally close, but noticeably different, usages of this notation: infinite asymptotics and infinitesimal
Infinitesimal

Infinitesimals have been used to express the idea of objects so small that there is no way to see them or to measure them. For everyday life, an infinitesimal object is an object which is smaller than any possible measure....
 asymptotics. This distinction is only in application and not in principle, however—the formal definition for the "big O" is the same for both cases, only with different limits for the function argument.

Infinite asymptotics

Big O notation is useful when analyzing algorithms
Analysis of algorithms

To analyze an algorithm is to determine the amount of resources necessary to execute it. Most algorithms are designed to work with inputs of arbitrary length....
 for efficiency. For example, the time (or the number of steps) it takes to complete a problem of size n might be found to be T(n) = 4n2 - 2n + 2.

As n grows large, the n2 term
Term (mathematics)

The word term is from the Latin terminus which literally means "boundary line, limit", from the Proto-Indo-European root "peg, post, boundary"....
 will come to dominate, so that all other terms can be neglected — for instance when n = 500, the term 4n2 is 1000 times as large as the 2n term. Ignoring the latter would have negligible effect on the expression's value for most purposes.

Further, the coefficient
Coefficient

In mathematics, a coefficient is a constant multiplication factor of a certain object. For example, in the expression 9x2, the coefficient of x2 is 9....
s become irrelevant if we compare to any other order
Orders of approximation

Orders of approximation have been used not only in science, engineering, and other quantitative disciplines to make approximations with various degrees of precision but also more generally, and more loosely, to indicate relative precision outside these disciplines in the form of "first level", "second level" and so on, "approximations"....
 of expression, such as an expression containing a term n3 or n2. Even if T(n) = 1,000,000n2, if U(n) = n3, the latter will always exceed the former once n grows larger than 1,000,000 (T(1,000,000) = 1,000,0003= U(1,000,000)). Additionally, the number of steps depends on the details of the machine model on which the algorithm runs, but different types of machines typically vary by only a constant factor in the number of steps needed to execute an algorithm.

So the big O notation captures what remains: we write either or and say that the algorithm has order of n2 time complexity.

Note that "=" is not meant to express "is equal to" in its normal mathematical sense, but rather a more colloquial "is", so the second expression is technically accurate (see the "Equals sign" discussion below) while the first is a common abuse of notation
Abuse of notation

In mathematics, abuse of notation occurs when an author uses a mathematical notation in a way that is not formally correct but that seems likely to simplify the exposition or suggest the correct intuition ....
.

Infinitesimal asymptotics

Big O can also be used to describe the error term in an approximation to a mathematical function. For example, expresses the fact that the error, the difference , is smaller in absolute value
Absolute value

In mathematics, the absolute value of a real number is its numerical value without regard to its Negative and non-negative numbers. So, for example, 3 is the absolute value of both 3 and -3....
 than some constant times when is close enough to .

Example

Take the polynomials
Polynomial

In mathematics, a polynomial is an expression constructed from variables and constants, using the operations of addition, subtraction, multiplication, and constant non-negative whole number exponents....
:

We say has order or (as )

Applying the formal definition from above

Proof:
for all (we take ):
where in this example

Properties


If a function f(n) can be written as a finite sum of other functions, then the fastest growing one determines the order of f(n). For example

In particular, if a function may be bounded by a polynomial in n, then as n tends to infinity, one may disregard lower-order terms of the polynomial.

and are very different. The latter grows much, much faster, no matter how big the constant c is (as long as it is greater than one). A function that grows faster than any power of n is called superpolynomial. One that grows more slowly than any exponential function of the form is called subexponential. An algorithm can require time that is both superpolynomial and subexponential; examples of this include the fastest known algorithms for integer factorization
Integer factorization

In number theory, integer factorization is the breaking down of a composite number into smaller non-trivial divisors, which when multiplied together equal the original integer....
.

is exactly the same as . The logarithms differ only by a constant factor, (since ) and thus the big O notation ignores that. Similarly, logs with different constant bases are equivalent. Exponentials with different bases, on the other hand, are not of the same order. For example, and are not of the same order.

Changing units may or may not affect the order of the resulting algorithm. Changing units is equivalent to multiplying the appropriate variable by a constant wherever it appears. For example, if an algorithm runs in the order of n2, replacing n by cn means the algorithm runs in the order of , and the big O notation ignores the constant . This can be written as . If, however, an algorithm runs in the order of , replacing n with cn gives . This is not equivalent to (unless, of course, c=1).

Changing of variable may affect the order of the resulting algorithm. For example, if an algorithm runs on the order of O(n) when n is the number of digits of the input number, then it has order O(log n) when n is the input number itself.

Product



Sum


This implies , which means that is a convex cone
Convex cone

In linear algebra, a convex cone is a subset of a vector space that is closure under linear combinations with positive coefficients....
.

If f and g are positive functions,


Multiplication by a constant

Let k be a constant. Then:


Multiple variables

Big O (and little o, and O...) can also be used with multiple variables.

To define Big O formally for multiple variables, suppose and are two functions defined on some subset of . We say

if and only if
If and only if

If and only if, in logic and fields that rely on it such as mathematics and philosophy, is a biconditional logical connective between statements....


For example, the statement

asserts that there exist constants C and M such that where g(n,m) is defined by

Note that this definition allows all of the coordinates of to increase to infinity. In particular, the statement

(i.e. ) is quite different from

(i.e. ).

Matters of notation


Equals sign

The statement " is " as defined above is usually written as . This is a slight abuse of notation; equality of two functions is not asserted, and it cannot be since the property of being is not symmetric:

.

There is also a second reason why that notation is not precise. The symbol f(x) means the value of the function f for the argument x. Hence the symbol of the function is f and not f(x).

For these reasons, some authors prefer set notation
Set notation

Set are fundamental objects in mathematics. Intuitively, a set is merely a collection of element or members. There are various conventions for textually denoting sets....
 and write , thinking of as the set of all functions dominated by g.

Other arithmetic operators

Big O notation can also be used in conjunction with other arithmetic operators in more complicated equations. For example, h(x) + O(f(x)) denotes the collection of functions having the growth of h(x) plus a part whose growth is limited to that of f(x). Thus, expresses the same as

Example
Suppose an algorithm is being developed to operate on a set of n elements. Its developers are interested in finding a function T(n) that will express how long the algorithm will take to run (in some arbitrary measurement of time) in terms of the number of elements in the input set. The algorithm works by first calling a subroutine to sort the elements in the set and then perform its own operations. The sort has a known time complexity of , and after the subroutine runs the algorithm must take an additional time before it terminates. Thus the overall time complexity of the algorithm can be expressed as

This can perhaps be most easily read by replacing with "some function that grows asymptotically slower than ". Again, this usage disregards some of the formal meaning of the "=" and "+" symbols, but it does allow one to use the big O notation as a kind of convenient placeholder.

Declaration of variables

Another feature of the notation, although less exceptional, is that function arguments may need to be inferred from the context when several variables are involved. The following two right-hand side big O notations have dramatically different meanings: The first case states that f(m) exhibits polynomial growth, while the second, assuming m > 1, states that g(n) exhibits exponential growth. To avoid confusion, some authors use the notation rather than the less explicit

Complex usages

In more complex usage, can appear in different places in an equation, even several times on each side. For example, the following are true for The meaning of such statements is as follows: for any functions which satisfy each on the left side, there are some functions satisfying each on the right side, such that substituting all these functions into the equation makes the two sides equal. For example, the third equation above means: "For any function , there is some function such that ." In terms of the "set notation" above, the meaning is that the class of functions represented by the left side is a subset of the class of functions represented by the right side.

Orders of common functions

Here is a list of classes of functions that are commonly encountered when analyzing algorithms. In each case, c is a constant and n increases without bound. The slower-growing functions are listed first.

Notation Name Example
constant
Constant time

In computational complexity theory, constant time, or Big O notation time, refers to the computation time of a problem when the time needed to solve that problem is bounded by a value that does not depend on the size of the data it is given as input....
 
Determining if a number is even or odd; using a constant-size lookup table
Lookup table

In computer science, a lookup table is a data structure, usually an array or associative array, often used to replace a runtime computation with a simpler array indexing operation....
 or hash table
Hash table

In computer science, a hash table, or a hash map, is a data structure that associates Unique key with value .The primary operation that hash functions support efficiently is a lookup: given a key , find the corresponding value ....
inverse Ackermann
Ackermann function

In computability theory, the Ackermann function or Ackermann?P?ter function is a simple example of a computable function that is not Primitive recursive function....
 
Amortized time
Amortized analysis

In computer science, especially analysis of algorithms, amortized analysis finds the average running time per operation over a worst-case sequence of operations....
 per operation using a disjoint set
iterated logarithmic
Iterated logarithm

In computer science, the iterated logarithm of n, written log*n , is the number of times the logarithm function must be iteratively applied before the result is less than or equal to 1....
 
The find algorithm of Hopcroft
John Hopcroft

John Edward Hopcroft is a renowned theoretical computer scientist.He received his bachelor's degree in electrical engineering from Seattle University in 1961 and his master's degree and Doctor of Philosophy from Stanford University in 1962 and 1964, respectively....
 and Ullman
Jeffrey Ullman

Jeffrey D. Ullman is a renowned computer scientist. His textbooks on compilers , data structures, theory of computation, and databases are regarded as standards in their fields....
 on a disjoint set
log-logarithmic Amortized time per operation using a bounded priority queue
Priority queue

A priority queue is an abstract data type in computer programming that supports the following three operations:* InsertWithPriority: add an element to the Queue_ with an associated priority...
logarithm
Logarithm

In mathematics, the logarithm of a number to a given base is the Power or exponent to which the base must be raised in order to produce the number....
ic
Finding an item in a sorted array with a binary search
Binary search algorithm

In computer science, a binary search algorithm is a technique for locating a particular value in a Collation. The method makes progressively better guesses, and closes in on the location of the sought value by selecting the middle element in the span , comparing its value to the target value, and determining if it is greater than, less than,...
polylogarithmic
Polylogarithmic

A polylogarithmic function in n is a polynomial in the logarithm of n,In computer science, polylogarithmic functions occur as the Big O notation of space complexity by some algorithms ....
 
Deciding if n is prime with the AKS primality test
AKS primality test

The AKS primality test is a deterministic algorithm primality test algorithm created and published by three Indian Institute of Technology Kanpur computer scientists, Manindra Agrawal, Neeraj Kayal, and Nitin Saxena on August 6, 2002 in a paper titled PRIMES is in P....
fractional power Searching in a kd-tree
Kd-tree

In computer science, a kd-tree is a space partitioning data structure for organizing Point s in a k-dimensional Euclidean space. kd-trees are a useful data structure for several applications, such as searches involving a multidimensional search key ....
linear
Linear function

In mathematics, the term linear function can refer to either of two different but related concepts: a first-degree polynomial function of one variable; or a map between two vector spaces that preserves vector addition and scalar multiplication....
 
Finding an item in an unsorted list; adding two n-digit numbers
linearithmic, loglinear, or quasilinear Performing a Fast Fourier transform
Fast Fourier transform

A fast Fourier transform is an efficient algorithm to compute the discrete Fourier transform and its inverse. There are many distinct FFT algorithms involving a wide range of mathematics, from simple complex number to group theory and number theory; this article gives an overview of the available techniques and some of their general propert...
; heapsort
Heapsort

Heapsort is a comparison sort sorting algorithm, and is part of the selection sort family. Although somewhat slower in practice on most machines than a good implementation of quicksort, it has the advantage of a worst-case big O notation runtime....
, or merge sort
Merge sort

Merge sort or merge_sort is an Big O notation comparison sort sorting algorithm. In most implementations it is Sorting algorithm#Classification, meaning that it preserves the input order of equal elements in the sorted output....
quadratic
Quadratic function

A quadratic function, in mathematics, is a polynomial function of the form , where . The graph of a function of a quadratic function is a parabola whose major axis is parallel to the y-axis....
 
Multiplying two n-digit numbers by a simple algorithm; adding two n×n matrices; bubble sort
Bubble sort

Bubble sort is a simple sorting algorithm. It works by repeatedly stepping through the list to be sorted, comparing two items at a time and swapping them if they are in the wrong order....
, shell sort
Shell sort

Shell sort is a sorting algorithm that is a generalization of insertion sort, with two observations:*insertion sort is efficient if the input is "almost sorted", and...
, quicksort
Quicksort

Quicksort is a well-known sorting algorithm developed by C. A. R. Hoare that, average performance, makes comparisons to sort n items. However, in the Best, worst and average case, it makes comparisons....
, or insertion sort
Insertion sort

Insertion sort is a simple sorting algorithm, a comparison sort in which the sorted array is built one entry at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort....
cubic
Cubic function

In mathematics, a cubic function is a function of the formwhere a is nonzero; or in other words, a polynomial of Degree of a polynomial three....
 
Multiplying two n×n matrices by simple algorithm; finding the shortest path on a weighted digraph with the Floyd-Warshall algorithm
Floyd-Warshall algorithm

In computer science, the Floyd?Warshall algorithm is a graph analysis algorithm for finding shortest path problem in a weighted, directed graph....
; inverting a (dense
Sparse matrix

In the mathematics subfield of numerical analysis a sparse matrix is a matrix populated primarily with zeros .Conceptually, sparsity corresponds to systems which are loosely coupled....
) nxn matrix using LU
LU decomposition

In linear algebra, the LU decomposition is a matrix decomposition which writes a matrix as the product of a lower triangular matrix and an upper triangular matrix....
 or Cholesky decomposition
Cholesky decomposition

In linear algebra, a subfield of mathematics, the Cholesky decomposition is a matrix decomposition of a symmetric matrix, positive-definite matrix matrix into a lower triangular matrix and the transpose of the lower triangular matrix....
polynomial
Polynomial

In mathematics, a polynomial is an expression constructed from variables and constants, using the operations of addition, subtraction, multiplication, and constant non-negative whole number exponents....
 or algebraic
Tree-adjoining grammar
Tree-adjoining grammar

Tree-adjoining grammar is a grammar formalism defined by Aravind Joshi. Tree-adjoining grammars are somewhat similar to context-free grammars, but the elementary unit of rewriting is the tree rather than the symbol....
 parsing; maximum matching
Matching

In the mathematical discipline of graph theory a matching or edge-independent set in a graph is a set of edges without common vertex . It may also be an entire graph consisting of edges without common vertices....
 for bipartite graph
Bipartite graph

In the mathematics field of graph theory, a bipartite graph is a graph whose vertex can be divided into two disjoint sets U and V such that every edge connects a vertex in U to one in V; that is, U and V are independent sets....
s (grows faster than cubic if and only if
If and only if

If and only if, in logic and fields that rely on it such as mathematics and philosophy, is a biconditional logical connective between statements....
 )

L-notation
L-notation

L-notation is an asymptotic analysis notation analogous to big-O notation, denoted as for a bound variable limit . Like big-O notation, it is usually used to roughly convey the computational complexity of a particular algorithm....
 
Factoring a number using the special
Special number field sieve

The special number field sieve is a special-purpose integer factorization algorithm. The general number field sieve was derived from it.The special number field sieve is efficient for integers of the form re ± s, where r and s are small ....
 or general number field sieve
General number field sieve

In mathematics, the general number field sieve is the most algorithmic efficiency classical algorithm known for integer factorization larger than 100 digits....
exponential
Exponential function

The exponential function is a function in mathematics. The application of this function to a value x is written as exp. Equivalently, this can be written in the form ex, where e is the mathematical constant that is the base of the natural logarithm and that is also known as Euler's number....
 or geometric
Geometric progression

In mathematics, a geometric progression, also known as a geometric sequence, is a sequence of numbers where each term after the first is found by multiplying the previous one by a fixed non-zero number called the common ratio....
 
Finding the (exact) solution to the traveling salesman problem using dynamic programming
Dynamic programming

In mathematics and computer science, dynamic programming is a method of solving problems that exhibit the properties of overlapping subproblems and optimal substructure ....
; determining if two logical statements are equivalent using brute force
Brute force

Brute force may refer to:* Brute-force search, a trivial computer problem-solving technique* Brute force attack, a method of defeating a cryptographic scheme by trying a large number of possibilities...
factorial
Factorial

In mathematics, the factorial of a negative and non-negative numbers integer n, denoted by n!, is the Product of all positive integers less than or equal to n....
 or combinatorial
Solving the traveling salesman problem via brute-force search
Brute-force search

In computer science, brute-force search or exhaustive search, also known as generate and test, is a trivial but very general problem-solving technique that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfies the problem's statement....
; finding the determinant
Determinant

In algebra, a determinant is a function depending on n that associates a scalar , det, to an n?n square matrix A. The fundamental geometric meaning of a determinant is a scale factor for measure when A is regarded as a linear transformation....
 with expansion by minors. The statement is sometimes weakened to to derive simpler formulas for asymptotic complexity.
double exponential
Double exponential function

A double exponential function is a constant raised to the power of an exponential function. The general formula is , which grows even faster than an exponential function....
 
Deciding the truth of a given statement in Presburger arithmetic
Presburger arithmetic

Presburger arithmetic is the first-order predicate calculus of the natural numbers with addition, named in honor of Mojzesz Presburger, who introduced it in 1929....


Remarks:

Larger growth, such as the single-valued version of the Ackermann function
Ackermann function

In computability theory, the Ackermann function or Ackermann?P?ter function is a simple example of a computable function that is not Primitive recursive function....
, A(n,n) is uncommon in practice.

For any and , is a subset of for any , so may be considered as a polynomial with some bigger order.

Related asymptotic notations

Big O is the most commonly used asymptotic notation for comparing functions, although in many cases Big O may be replaced with Big Theta T for asymptotically tighter bounds (Theta
Theta

Theta is the eighth letter of the Greek alphabet, derived from the Phoenician letter Teth. In the system of Greek numerals it has a value of 9....
, see below). Here, we define some related notations in terms of Big O, progressing up to the family of Bachmann–Landau notations to which Big O notation belongs.

Little- notation

The relation is read as " is little-o of ". Intuitively, it means that grows much faster than . It assumes that f and g are both functions of one variable. Formally, it states that the limit
Limit (mathematics)

In mathematics, the concept of a "limit" is used to describe the behavior of a Function as its argument or input either "gets close" to some point, or as the argument becomes arbitrarily large; or the behavior of a sequence's elements as their index increases indefinitely....
 of is zero, as x approaches infinity. For algebraically defined functions and , is generally found using L'Hôpital's rule
L'Hôpital's rule

In calculus, l'H?pital's rule uses derivatives to help evaluate limit s involving indeterminate forms. Application of the rule often converts an indeterminate form to a determinate form, allowing easy evaluation of the limit....
.

For example,



Little-o notation is common in mathematics but rarer in computer science. In computer science the variable (and function value) is most often a natural number. In math, the variable and function values are often real numbers. The following properties can be useful:

  • (and thus the above properties apply with most combinations of o and O).


As with big O notation, the statement " is " is usually written as , which is a slight abuse of notation.

The family of Bachmann–Landau notations

NotationNameIntuitionAs , eventually...Definition
 Big Omicron; Big O; Big Oh is bounded above by (up to constant factor) asymptotically  or
 Big Omega is bounded below by (up to constant factor) asymptotically  
 Big Theta is bounded both above and below by asymptotically  
 Small Omicron; Small O; Small Oh is dominated by asymptotically  
 Small Omega dominates asymptotically  
 on the order of is equal to asymptotically  


Bachmann–Landau notation was designed around several mnemonic
Mnemonic

A mnemonic device is a memory aid. Commonly met mnemonics are often verbal, something such as a very short poem or a special word used to help a person remember something, particularly lists, but may be visual, kinesthetic or auditory....
s, as shown in the As , eventually... column above and in the bullets below. To conceptually access these mnemonics, "omicron" can be read "o-micron" and "omega" can be read "o-mega". Also, the lower-case versus capitalization of the Greek letters in Bachmann–Landau notation is mnemonic.
  • the o-micron mnemonic: The o-micron reading of and of can be thought of as "O-smaller than" and "o-smaller than", respectively. This micro/smaller mnemonic refers to: for sufficiently large input parameter(s), grows at a rate that may henceforth be less than regarding or .
  • the o-mega mnemonic: The o-mega reading of and of can be thought of as "O-larger than". This mega/larger mnemonic refers to: for sufficiently large input parameter(s), grows at a rate that may henceforth be greater than regarding or .
  • the upper-case mnemonic: This mnemonic reminds us when to use the upper-case Greek letters in and : for sufficiently large input parameter(s), grows at a rate that may henceforth be equal to regarding .
  • the lower-case mnemonic: This mnemonic reminds us when to use the lower-case Greek letters in and : for sufficiently large input parameter(s), grows at a rate that is henceforth inequal to regarding .


Aside from Big O notation, the Big Theta T and Big Omega O notations are the two most often used in computer science; the Small Omega ? notation is rarely used in computer science.

Informally, especially in computer science, the Big O notation often is permitted to be somewhat abused to describe an asymptotic tight bound where using Big Theta T notation might be more factually appropriate in a given context. For example, when considering a function , all of the following are generally acceptable, but tightnesses of bound (i.e., bullets 2 and 3 below) are usually strongly preferred over laxness of bound (i.e., bullet 1 below).

  1. , which is identical to
  2. , which is identical to
  3. , which is identical to


The equivalent English statements are respectively:

  1. grows asymptotically as fast or more slowly than
  2. grows asymptotically as fast or more slowly than
  3. grows asymptotically as fast as


So while all three statements are true, progressively more information is contained in each. In some fields, however, the Big O notation (bullets number 2 in the lists above) would be used more commonly than the Big Theta notation (bullets number 3 in the lists above) because functions that grow more slowly are more desirable. For example, if represents the running time of a newly developed algorithm for input size , the inventors and users of the algorithm might be more inclined to put an upper asymptotic bound on how long it will take to run without making an explicit statement about the lower asymptotic bound.

Extensions to the Bachmann–Landau notations

Another notation sometimes used in computer science is Õ (read soft-O). is shorthand for for some k. Essentially, it is Big O notation, ignoring logarithmic factors because the growth-rate effects of some other super-logarithmic function indicate a growth-rate explosion for large-sized input parameters that is more important to predicting bad run-time performance than the finer-point effects contributed by the logarithmic-growth factor(s). This notation is often used to obviate the "nitpicking" within growth-rates that are stated as too tightly bounded for the matters at hand (since is always for any constant and any ).

The L
L-notation

L-notation is an asymptotic analysis notation analogous to big-O notation, denoted as for a bound variable limit . Like big-O notation, it is usually used to roughly convey the computational complexity of a particular algorithm....
 notation, defined as

is convenient for functions that are between polynomial and exponential.

Generalizations and related usages

The generalization to functions taking values in any normed vector space
Normed vector space

In mathematics, with 2- or 3-dimensional Vector s with real number-valued entries, the idea of the "length" of a vector is intuitive and can easily be extended to any Vector space Rn....
 is straightforward (replacing absolute values by norms), where f and g need not take their values in the same space. A generalization to functions g taking values in any topological group
Topological group

In mathematics, a topological group is a group G together with a topological space on G such that the group's binary operation and the group's inverse function are continuous function ....
 is also possible.

The "limiting process" x?xo can also be generalized by introducing an arbitrary filter base, i.e. to directed net
Net (mathematics)

In topology and related areas of mathematics a net or Moore-Smith sequence is a generalization of a sequence, intended to unify the various notions of limit and generalize them to arbitrary topological spaces....
s f and g.

The o notation can be used to define derivative
Derivative

In calculus, a branch of mathematics, the derivative is a measure of how a function changes as its input changes. Loosely speaking, a derivative can be thought of as how much a quantity is changing at a given point....
s and differentiability in quite general spaces, and also (asymptotical) equivalence of functions, which is an equivalence relation
Equivalence relation

In mathematics, an equivalence relation is, loosely, a binary relation on a Set that specifies how to split up the set into subsets such that every element of the larger set is in exactly one of the subsets....
 and a more restrictive notion than the relationship "f is T(g)" from above. (It reduces to if f and g are positive real valued functions.) For example, 2x is T(x), but 2x − x is not o(x).

Graph theory

It is often useful to bound the running time of graph
Graph (mathematics)

In mathematics a graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected objects are represented by mathematical abstractions called vertices, and the links that connect some pairs of vertices are called edges....
 algorithms. Unlike most other computational problems, for a graph G = (V, E) there are two relevant parameters describing the size of the input: the number |V| of vertices in the graph and the number |E| of edges in the graph. Inside asymptotic notation (and only there), it is common to use the symbols V and E, when someone really means |V| and |E|. We adopt this convention here to simplify asymptotic functions and make them easily readable. The symbols V and E are never used inside asymptotic notation with their literal meaning, so this abuse of notation does not risk ambiguity. For example means for a suitable metric of graphs. Another common convention—referring to the values |V| and |E| by the names n and m, respectively—sidesteps this ambiguity.

See also


  • Asymptotic expansion
    Asymptotic expansion

    In mathematics an asymptotic expansion, asymptotic series or Poincar? expansion is a formal series of functions which has the property that truncating the series after a finite number of terms provides an approximation to a given function as the argument of the function tends towards a particular, often infinite, point....
    : Approximation of functions generalizing Taylor's formula
  • Asymptotically optimal
    Asymptotically optimal

    In computer science, an algorithm is said to be asymptotically optimal if, roughly speaking, for large inputs it performs at worst a constant factor worse than the best possible algorithm....
    : A phrase frequently used to describe an algorithm that has an upper bound asymptotically within a constant of a lower bound for the problem
  • Hardy notation
    Hardy notation

    In complexity theory and mathematics, the Hardy notation, introduced by G. H. Hardy, is used for asymptotic comparison of functions, equivalently to Landau notation ....
    : A different asymptotic notation
  • Limit superior and limit inferior
    Limit superior and limit inferior

    In mathematics, the limit inferior and limit superior of a sequence can be thought of as limiting bounds on the sequence. The limit inferior and limit superior of a function can be thought of in a similar fashion The limit inferior and limit superior of a set are the infimum and supremum of the set's limit points respectively....
    : An explanation of some of the limit notation used in this article
  • Nachbin's theorem
    Nachbin's theorem

    In mathematics, in the area of complex analysis, Nachbin's theorem is commonly used to establish a bound on the growth rates for an analytic function....
    : A precise method of bounding complex analytic functions so that the domain of convergence of integral transform
    Integral transform

    In mathematics, an integral transform is any list of transforms T of the following form:The input of this transform is a function f, and the output is another function TF....
    s can be stated


Further reading

  • Paul Bachmann
    Paul Bachmann

    Paul Gustav Heinrich Bachmann was a Germany mathematician.Bachmann studied mathematics at the University of his native city of Berlin andreceived his doctorate in 1862 for his thesis on group theory....
    . Die Analytische Zahlentheorie. Zahlentheorie. pt. 2 Leipzig: B. G. Teubner, 1894.
  • Edmund Landau
    Edmund Landau

    Edmund Georg Hermann Landau was a Germany Jewish mathematician and author of over 250 papers on number theory.Edmund Landau was born in Berlin to a wealthy Jewish family....
    . Handbuch der Lehre von der Verteilung der Primzahlen. 2 vols. Leipzig: B. G. Teubner, 1909.
  • G. H. Hardy
    G. H. Hardy

    G. H. Hardy Fellow of the Royal Society was a prominent England mathematics, known for his achievements in number theory and mathematical analysis....
    . Orders of Infinity: The 'Infinitärcalcül' of Paul du Bois-Reymond, 1910.
  • Marian Slodicka (Slodde vo de maten) & Sandy Van Wontergem. Mathematical Analysis I. University of Ghent, 2004.
  • Donald Knuth
    Donald Knuth

    Donald Ervin Knuth is a renowned computer science and Emeritus of the Art of Computer Programming at Stanford University.Author of the seminal multi-volume work The Art of Computer Programming , Knuth has been called the "father" of the run-time analysis, contributing to the development of, and systematizing formal mathematical techn...
    . The Art of Computer Programming, Volume 1: Fundamental Algorithms, Third Edition. Addison-Wesley, 1997. ISBN 0-201-89683-4. Section 1.2.11: Asymptotic Representations, pp.107–123.
  • Thomas H. Cormen
    Thomas H. Cormen

    Thomas H. Cormen is the co-author of Introduction to Algorithms, along with Charles Leiserson, Ron Rivest, and Clifford Stein. He is a Full Professor of computer science at Dartmouth College and currently Chair of the Dartmouth College Writing Program....
    , Charles E. Leiserson
    Charles E. Leiserson

    Charles Eric Leiserson is a computer scientist, specializing in the theory of parallel computing and distributed computing, and particularly practical applications thereof; as part of this effort, he developed the Cilk multithreaded language....
    , Ronald L. Rivest, and Clifford Stein
    Clifford Stein

    Clifford Stein, a computer scientist, is currently a professor of industrial engineering and operations research at Columbia University in New York, NY, where he also holds an appointment in the Department of Computer Science....
    . Introduction to Algorithms
    Introduction to Algorithms

    Introduction to Algorithms is a book by Thomas H. Cormen, Charles E. Leiserson, Ron Rivest, and Clifford Stein. It is used as the textbook for algorithms courses at many universities....
    , Second Edition. MIT Press and McGraw-Hill, 2001. ISBN 0-262-03293-7. Section 3.1: Asymptotic notation, pp.41–50.
Pages 226–228 of section 7.1: Measuring complexity.
  • Jeremy Avigad, Kevin Donnelly.
  • Paul E. Black, , in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed., U.S. National Institute of Standards and Technology. 11 March 2005. Retrieved December 16, 2006.
  • Paul E. Black, , in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed., U.S. National Institute of Standards and Technology. 17 December 2004. Retrieved December 16, 2006.
  • Paul E. Black, , in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed., U.S. National Institute of Standards and Technology. 17 December 2004. Retrieved December 16, 2006.
  • Paul E. Black, , in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed., U.S. National Institute of Standards and Technology. 29 November 2004. Retrieved December 16, 2006.
  • Paul E. Black, , in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed., U.S. National Institute of Standards and Technology. 17 December 2004. Retrieved December 16, 2006.


External links