Orders of Common Functions
Further information: Time complexity#Table of common time complexitiesHere is a list of classes of functions that are commonly encountered when analyzing the running time of an algorithm. In each case, c is a constant and n increases without bound. The slower-growing functions are generally listed first.
| Notation | Name | Example |
|---|---|---|
| constant | Determining if a number is even or odd; using a constant-size lookup table | |
| double logarithmic | Finding an item using interpolation search in a sorted array of uniformly distributed values. | |
| logarithmic | Finding an item in a sorted array with a binary search or a balanced search tree as well as all operations in a Binomial heap. | |
| fractional power | Searching in a kd-tree | |
| linear | Finding an item in an unsorted list or a malformed tree (worst case) or in an unsorted array; Adding two n-bit integers by ripple carry. | |
| n log-star n | Performing triangulation of a simple polygon using Seidel's algorithm. (Note ![]() |
|
| linearithmic, loglinear, or quasilinear | Performing a Fast Fourier transform; heapsort, quicksort (best and average case), or merge sort | |
| quadratic | Multiplying two n-digit numbers by a simple algorithm; bubble sort (worst case or naive implementation), Shell sort, quicksort (worst case), selection sort or insertion sort | |
| polynomial or algebraic | Tree-adjoining grammar parsing; maximum matching for bipartite graphs | |
| L-notation or sub-exponential | Factoring a number using the quadratic sieve or number field sieve | |
| exponential | Finding the (exact) solution to the travelling salesman problem using dynamic programming; determining if two logical statements are equivalent using brute-force search | |
| factorial | Solving the traveling salesman problem via brute-force search; generating all unrestricted permutations of a poset; finding the determinant with expansion by minors. |
The statement is sometimes weakened to to derive simpler formulas for asymptotic complexity. For any and, is a subset of for any, so may be considered as a polynomial with some bigger order.
Read more about this topic: Big O Notation
Famous quotes containing the words orders, common and/or functions:
“There is nothing on earth more exquisite than a bonny book, with well-placed columns of rich black writing in beautiful borders, and illuminated pictures cunningly inset. But nowadays, instead of looking at books, people read them. A book might as well be one of those orders for bacon and bran.”
—George Bernard Shaw (18561950)
“Nobody can deny but religion is a comfort to the distressed, a cordial to the sick, and sometimes a restraint on the wicked; therefore whoever would argue or laugh it out of the world without giving some equivalent for it ought to be treated as a common enemy.”
—Mary Wortley, Lady Montagu (16891762)
“One of the most highly valued functions of used parents these days is to be the villains of their childrens lives, the people the child blames for any shortcomings or disappointments. But if your identity comes from your parents failings, then you remain forever a member of the child generation, stuck and unable to move on to an adulthood in which you identify yourself in terms of what you do, not what has been done to you.”
—Frank Pittman (20th century)
