Polynomial Running Time describes an algorithm which, when the input size doubles, it’s Running Time only decreases by a factor of some constant .
This may also be referred to commonly as fast or quick Running Time.
Example:
int[] array = new int[]{0, 1, 2, ...};
for (int i = 0; i < array.length; i++)
for (jnt j = 0; j < array.length; j++)
if (condition(array[i], array[j]))
doThing();
Here the running time is which is a polynomial with constant .
Relations:
For two algorithms and , the following can be established between them (comparing Running Time):
- If and can be solved in polynomial Running Time, then can also be solved in polynomial Running Time.
- If and can’t be solved in polynomial Running Time, then cannot also be solved in polynomial Running Time.
- If and , described with notation , can be solved in polynomial Running Time if can be.