- Polynomial time
In
computational complexity theory , polynomial time refers to thecomputation time of a problem where therun time , "m"("n"), is no greater than apolynomial function of theproblem size , "n".Written mathematically usingbig O notation , this states that where "k" is some constant that may depend on the problem. For example, thequicksort sorting algorithm on "n" integers performs at most operations for some constant . Thus it runs in time and is a polynomial time algorithm.Mathematicians sometimes use the notion of "polynomial time on the length of the input" as a definition of a "fast" or "feasible" computation (see
Cobham's thesis ), as opposed tosub-exponential time (also super-polynomial time), which is anything slower than that.Exponential time is one example of a sub-exponential time.The
complexity class ofdecision problem s that can be solved on a deterministic sequential machine in polynomial time is known as P. The class of decision problems that can be verified in polynomial time is known as NP. Equivalently, NP is the class of decision problems that can be solved in polynomial time on anon-deterministic Turing machine (NP stands for Nondeterministic Polynomial time).P is the smallest time-complexity class on a deterministic machine which is robust in terms of machine model changes. (For example, a change from a single-tape
Turing machine to a multi-tape machine can lead to a quadratic speedup, but any algorithm that runs inpolynomial time under one model also does so on the other.) P is also the smallest class closed under composition of subproblems. Any givenabstract machine will have acomplexity class corresponding to the problems which can be solved inpolynomial time on that machine.Some texts use the term weakly polynomial
run time . This means thatrun time is polynomial not in the size of the input, but in the numerical value of the input, which may be exponentially larger. For example, theEuclidean Algorithm is only weakly polynomial when implemented using subtraction.Similarly, running in strongly polynomial time means that the algorithm's
run time is independent of the numerical data size and depends only on the inherent dimensions of the problem. For example, an algorithm which could sort "n" integers each less than "k" in time would be strongly polynomial, while an algorithm sorting them in time would be weakly polynomial (because an integer less than "k" can be represented in size logarithmic in "k").See also
*
Constant time
*Linear time
*Complexity classes P and NPReferences
*
Wikimedia Foundation. 2010.