estimate of time taken for running an algorithm
In theoretical computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the … Wikipedia
🌐
Wikipedia
en.wikipedia.org › wiki › Time_complexity
Time complexity - Wikipedia
January 18, 2026 - An algorithm is said to be of polynomial time if its running time is upper bounded by a polynomial expression in the size of the input for the algorithm, that is, T(n) = O(nk) for some positive constant k. Problems for which a deterministic polynomial-time algorithm exists belong to the complexity ...
Top answer
1 of 3
53

First, consider a Turing machine as a model (you can use other models too as long as they are Turing equivalent) of the algorithm at hand. When you provide an input of size , then you can think of the computation as a sequence of the machine's configuration after each step, i.e., . Hopefully, the computation is finite, so there is some such . Then is the running time of the given algorithm for an input of size .

An algorithm is polynomial (has polynomial running time) if for some , its running time on inputs of size is at most . Equivalently, an algorithm is polynomial if for some , its running time on inputs of size is . This includes linear, quadratic, cubic and more. On the other hand, algorithms with exponential running times are not polynomial.

There are things in between - for example, the best known algorithm for factoring runs in time for some constant ; such a running time is known as sub-exponential. Other algorithms could run in time for some and , and these are known as quasi-polynomial. Such an algorithm has very recently been claimed for discrete log over small characteristics.

2 of 3
10

Running an algorithm can take up some computing time. It mainly depends on how complex the algorithm is. Computer scientists have made a way to classify the algorithm based on its behaviour of how many operations it needs to perform (more ops take up more time).

One of that class shows polynomial time complexity. Ie., operational complexity is proportional to while n is size of input and c is some constant. Obviously the name comes because of which is a polynomial.

There are other 'types' of algorithms that take up constant time irrespective of the size of the input. Some take up time (yes, really slllooooww most of the time).

I just over simplified it for the layman and may have introduced errors. So read more https://stackoverflow.com/questions/4317414/polynomial-time-and-exponential-time

Discussions

complexity - Why do we focus on polynomial time, rather than other kinds of time? - Cryptography Stack Exchange
Polynomial time seems to be mentioned quite frequently on this site. It often forms a threshold between two possible outcomes like being secure or an attack's validity. I know what $\mathcal{O}(n^... More on crypto.stackexchange.com
🌐 crypto.stackexchange.com
September 17, 2018
algorithm - Polynomial time and exponential time - Stack Overflow
Keep in mind that if you put something ... go back to polynomial of course, e.g.: ... the general number field sieve the fastest 2020-known algorithm for integer factorization, see also: What is the fastest integer factorization algorithm? That algorithm has complexity of the ... More on stackoverflow.com
🌐 stackoverflow.com
ELI5: In complexity theory, what exactly is "polynomial time" with regards to computation of problem?
In the theory you're talking about, people are trying to be very general, to provide a way to compare algorithms (recipes for doing certain things) to each other. You cannot compare two algorithms with each other by measuring the precise time each one takes, because that depends a lot on the specific circumstances. For example, maybe you're comparing algorithms for sorting a list of numbers. Maybe if you give both algorithms list A, the first takes 10 seconds and the second takes 20 seconds... but if you feed a different list, list B, to those same algorithms, the first one takes 40 seconds but the second only takes 25. So which is "faster"? And that's on the same exact computer. People run the same algorithms on different computers. Instead of comparing directly like that, time complexity is based on the idea that each algorithm's performance is proportional in some way to how much stuff you ask it to work on. In other words, ever sorting algorithm will take more time on a longer list than on a shorter list. So what they're trying to describe is not how long each algorithm takes, but how it grows when you give it bigger inputs. A linear algorithm, for example, takes longer in some constant proportion to the amount of data you use it on. For example, a sorting algorithm that takes twice as long to sort a list that's twice as large is linear. Algorithms with polynomial time complexity take more time in proportion to some polynomial of the size if the input. For example, if an algorithm's time were roughly proportional to n2 (n-squared) then it would be polynomial... and it would take four times as long to sort a list that's twice as large, and 9 times as long to sort a list that's thrice as large. I'm oversimplifying a lot, and glossing over things like upper and lower bounds, but that's the basic idea. Time complexity doesn't tell you how fast something will run; it tells you how fast it will scale up when you run it on much larger amounts of data. More on reddit.com
🌐 r/explainlikeimfive
6
0
September 3, 2013
algorithm - Polynomial Time Complexity O(N) - Stack Overflow
Polynomial Time Complexity is usually presented as an upper-bounds limit, so that would mean that only (B) is not in polynomial time complexity. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Reddit
reddit.com › r/askscience › what is polynomial time? (in layman terms)
r/askscience on Reddit: What is polynomial time? (In layman terms)
September 26, 2013 -

I was reading this (http://www.princeton.edu/~achaney/tmve/wiki100k/docs/Polynomial_time.html) and I also want to know what "big O notation" is. Thanks!

Top answer
1 of 5
17
The time a computation will take usually depends on the amount of input data to the computation -- it takes longer to sort a long list of numbers than a short one. However, depending on the computation in question, the dependency of the time T on the amount of input data will be different. For a particular algorithm the dependency might be measured to be T=2.1n2 +5n+6. This would be an example of a polynomial algorithm, since the expression for T is a polynomial, i.e. it contains terms like nk with k constant. As n gets very large, the n2 term in this case will be much bigger than the other terms, so we can ignore all the other terms without introducing much of an error. We also only care about the proportionality between n and T, so the 2.1 factor can be dropped as well, shortening T=2.1n2 +5n to simply T=n2 or the more common notation O(n2 ). Other algorithms may be O(n) or O(n3 ) etc., all of which are polynomial. Alternatively, an algorithm may run in constant time, i.e. the time is the same no matter how much input data there is. This is written as O(1). An example of a constant time algorithm is looking something up in a hash table. Search in a binary tree is logarithmic, O(log(n)), so each time the data set size is four times larger, the search takes only twice as long, since adding four times as much data to a binary tree only doubles the depth of the tree. Good sorting algorithms are O(nlog(n)). Some difficult problems are exponential, O(2n ), in which case adding just one more element to the input data doubles the time it takes to solve. Even worse are factorial problems O(n!). The general difficulty (or cost in terms of time spent) of a calculation can be characterized by the complexity, with O(1) being the fastest/cheapest, then polynomial time, the lower exponent the better, then exponential and factorial and the really hard problems. Algorithms also have a space complexity, i.e. how much memory is required to solve the problem. It is approached in the same way, and also uses big-O notation. An algorithm need not have the same time and space complexity, in fact often we get better time performance at the cost of bigger memory footprint.
2 of 5
4
Let's first talk about super-polynomial time, to better understand why polynomial time is important. A famous problem in computer science is the Traveling Salesman Problem , often abbreviated to TSP. TSP asks: "Imagine that you are a salesman, who has to travel to a number of different cities, and you know the distances between each pair of these cities. What is the most efficient order in which you can visit each city (i.e. what is the least distance you need to travel in total)?". The obvious way to solve this problem is to try all permutations of ordering the cities and seeing which ordering requires the least total distance to be travelled. For example, if the cities are A, B & C, you can visit them in one of these orders: A -> B -> C A -> C -> B B -> A -> C B -> C -> A C -> A -> B C -> B -> A If you have N cities, you will have to consider N! or N x (N-1) x (N-2) ... 1 different permutations. Now consider how N! grows as N grows, compared to something like N2 (N*N): N N2 N! 1 1 1 2 4 2 3 9 6 4 16 24 5 25 120 6 36 720 7 49 5040 8 64 40320 9 81 362880 10 100 3628800 11 121 39916800 12 144 479001600 13 169 6227020800 14 196 87178291200 15 225 1307674368000 16 256 20922789888000 17 289 355687428096000 18 324 6402373705728000 19 361 121645100408832000 20 400 2432902008176640000 As can be seen, as N increases from 1 to 20, N2 grows pretty quickly too, but N! grows insanely fast. You can probably imagine how much the difference between N! and N2 will be when N is 1000, or a million, or a billion. N2 is an example of a polynomial function. There are an infinite number of polynomial functions, like N100, or N1 (just N), or N0 (just 1), but all of them will grow more slowly than N!. Therefore, it's clear that an algorithm whose solution time is a polynomial function of the input is way more useful than one whose solution time is a super-polynomial function of the input, especially if the input size may be quite large. Incidentally, TSP is an NP-Hard problem, which means there will never be an exact solution for it that works in polynomial time. We usually rely upon approximate solution techniques called heuristics, that solve it in polynomial time, but aren't guaranteed to return the best possible solution. Now for the Big-oh notation. We usually state that an algorithm is O(f(x)), where f(x) is a function of x. For example, the above TSP solution is O(N!). Remember when we enumerated each possible permutation of visiting the cities A, B, and C? Assume that it takes you some fixed amount of time to write down each permutation, and to calculate the total distance traveled according to that permutation (say 5 seconds). Let's also say that when you've enumerated all the possibilities, it takes you a fixed amount of time to compare them all and write down the best solution (say 10 seconds). Then for the {A, B, C} example above, it would take you 5 x 6 + 10 = 40 seconds to solve the problem. For N cities, it would take you 5 x N! + 10 seconds to solve the problem. We therefore say that our solution is O(N!) because if you allow for some constant amount of time taken to process each step, and some constant amount of time to process the overall solution, then our solution basically completes in no more than N! time. In other words, when you say that your algorithm is O(something), you're saying that as N increases beyond a point, your algorithm never takes more than 'something' time, allowing for some constant time to calculate each step and to compute the final result. Finally, big-oh notation can be used to make some very broad claims, not all of which are useful. For example, if you have an algorithm that always completes in 10 seconds, regardless of the input size, technically it also completes in no more than N! time, so you can say that our algorithm is O(N!). But this is a fairly useless statement, since it doesn't convey just how fast our algorithm really is. Therefore, you'd usually want to express your algorithm as O(f(x)) where f(x) is the lowest possible order of magnitude. Note: The big-oh explanation above is a little simplistic. It actually isn't necessary that the time taken to process the final solution is a constant like 10 sec - as long as it doesn't take an order of magnitude more time than the rest of the solution, for example. Edit: Formatting.
🌐
Bartleby
bartleby.com › bartleby textbook solutions › engineering q&a and textbook solutions › computer science q&a, textbooks, and solutions › polynomial time
Polynomial Time | bartleby
December 29, 2021 - An algorithm is said to be polynomial time if its running time is upper bounded by the polynomial expression in the size of the input for the algorithm. The polynomial time is represented as ... , where k is a positive constant and n is the complexity of input.
Top answer
1 of 3
10

The focus on polynomial time comes from cryptography's historical origin as a branch of computational complexity.

  • It makes sense for a theoretical field to develop technology-independent ways of measuring efficiency. Actual clock time or number of clock cycles are technology-dependent. Talking about running time in an asymptotic sense is convenient because it makes specific technology irrelevant. No matter how fast machine A is compared to machine B, if machine A runs a algorithm and machine B runs a algorithm, then eventually (for large enough ) machine B will be faster in terms of actual time.

  • Algorithms that run in time are objectively fast/scalable/"efficient".

  • Suppose an "efficient" algorithm makes calls to a subroutine (we don't count the cost of the subroutine against this algorithm), and the subroutine can also be realized by an "efficient" algorithm. Then, intuitively, the overall system (accounting for both the calling program & subroutine) should be "efficient" too. This is a basic composition property, and without it you have a very messy theory. Polynomial-time is the minimal way to define "efficient" that contains running time and enjoys this composition property.

It is for these reasons that "polynomial time" is synonymous with "efficient" in computational complexity. Its minimal nature makes it a natural and well-motivated definition.

However, just because it's well-motivated and natural doesn't mean it's sacred. Mihir Bellare points out asymptotic complexity as one of the arbitrary aspects of cryptographic research, to be critically examined.

As others have said here, there is plenty of work that follows a concrete (rather than asymptotic) style. There is nothing wrong with working in this style. The main differences are: (1) things are a little messier; you can't hide all the mess inside an unspecified polynomial; (2) you forfeit the (very convenient) composability property.

2 of 3
3

why do cryptographers not use other kinds of time for so many thresholds?

Actually cryptographer use non-asymptotic run-time specifications whenever there's a good reason for it. However whenever there's not asymptotic notions tend to be easier to come up with and allow one to more quickly assure oneself that something is (somewhat easily) feasible to compute. You see it a lot here on Crypto.SE probably because using asymptotic notions usually suffices to express that something is (in)feasible which is usually more the point of the question than precise runtime analysis.

Examples for when cryptographers actually prefer non-asymptotic results over asymptotic ones:

  • Security proofs. Sure you will find asymptotic proofs every now and then but most of them are concrete (ie give concrete upper bounds for probabilities and advantages) and it is actually advised to use concrete bounds over asymptotic ones because the hidden constants could be so big that it matters.
  • Runtime of implementations. Very rarely you will find serious cryptographers arguing about the efficiency of implementations using asymptotic notions like RSA e.g. taking operations. More often than not, concrete measurements are preferred. A similar argument holds for cryptographic implementation tricks which are usually stated in the number of underlying primitive operations, you can find examples when you are looking for efficient ECC additions and doublings.
  • Attack costs. Similar to security proofs most attacks will state that they need oracle / primitive evaluations to achieve probability of success using storage. As with run-time, asymptotic bounds would be completely useless here, because all (symmetric) crypto schemes can be broken in (with a hidden constant of or more).
🌐
Nature
nature.com › research-intelligence › nri-topic-summaries › complexity-theory-and-polynomial-time-algorithms-micro-386307
Complexity Theory and Polynomial Time Algorithms | Nature Research Intelligence
Complexity Theory: The study of the intrinsic difficulty of computational problems and the classification of algorithms according to the resources required for their solution. Polynomial Time Algorithm: An algorithm whose running time is upper bounded by a polynomial expression in the size of the input, considered efficient in computer science.
Find elsewhere
🌐
ScienceDirect
sciencedirect.com › topics › computer-science › polynomial-complexity
Polynomial Complexity - an overview | ScienceDirect Topics
Polynomial complexity refers to the classification of an algorithm where its running time grows at a polynomial rate relative to the size of the input, indicating that problems solvable by such algorithms are generally considered efficient.
🌐
GeeksforGeeks
geeksforgeeks.org › dsa › difference-between-exponential-and-polynomial-complexities
Difference Between Exponential and Polynomial Complexities - GeeksforGeeks
July 23, 2025 - An algorithm is said to have polynomial ... size, n. Formally, an algorithm has polynomial time complexity if its running time is O(nk) for some non-negative integer k....
🌐
Wolfram MathWorld
mathworld.wolfram.com › PolynomialTime.html
Polynomial Time -- from Wolfram MathWorld
October 2, 2004 - An algorithm is said to be solvable in polynomial time if the number of steps required to complete the algorithm for a given input is O(n^k) for some nonnegative integer k, where n is the complexity of the input.
🌐
LessWrong
lesswrong.com › w › p-polynomial-time-complexity-class
P (Polynomial Time Complexity Class)
August 3, 2016 - P is the class of problems which can be solved by algorithms whose run time is bounded by a polynomial. Parents: Complexity theory · Discussion · 1 · Discussion ·
🌐
Reddit
reddit.com › r/explainlikeimfive › eli5: in complexity theory, what exactly is "polynomial time" with regards to computation of problem?
r/explainlikeimfive on Reddit: ELI5: In complexity theory, what exactly is "polynomial time" with regards to computation of problem?
September 3, 2013 -

I understand that some computations take time and others don't seem to be solvable in a time frame. I think I understand this time frame is called "polynomial time" which I am assuming that it's a unit of measurment in a polynomial expression like in Algebra.

Now what I don't understand is what exactly is a "polynomial time" frame and why must we express it in polynomial form? What does that mean really and why not express it in something other than a polynomials?

Top answer
1 of 5
2
In the theory you're talking about, people are trying to be very general, to provide a way to compare algorithms (recipes for doing certain things) to each other. You cannot compare two algorithms with each other by measuring the precise time each one takes, because that depends a lot on the specific circumstances. For example, maybe you're comparing algorithms for sorting a list of numbers. Maybe if you give both algorithms list A, the first takes 10 seconds and the second takes 20 seconds... but if you feed a different list, list B, to those same algorithms, the first one takes 40 seconds but the second only takes 25. So which is "faster"? And that's on the same exact computer. People run the same algorithms on different computers. Instead of comparing directly like that, time complexity is based on the idea that each algorithm's performance is proportional in some way to how much stuff you ask it to work on. In other words, ever sorting algorithm will take more time on a longer list than on a shorter list. So what they're trying to describe is not how long each algorithm takes, but how it grows when you give it bigger inputs. A linear algorithm, for example, takes longer in some constant proportion to the amount of data you use it on. For example, a sorting algorithm that takes twice as long to sort a list that's twice as large is linear. Algorithms with polynomial time complexity take more time in proportion to some polynomial of the size if the input. For example, if an algorithm's time were roughly proportional to n2 (n-squared) then it would be polynomial... and it would take four times as long to sort a list that's twice as large, and 9 times as long to sort a list that's thrice as large. I'm oversimplifying a lot, and glossing over things like upper and lower bounds, but that's the basic idea. Time complexity doesn't tell you how fast something will run; it tells you how fast it will scale up when you run it on much larger amounts of data.
2 of 5
1
Here's some notation for a general overview (explaining like you're 5): Big-O notation refers to upper limit of a processes time-complexity based on the input. Because it's the upper limit, it deals with "worst-case scenarios" for a program. So say you have a program that has to run only three "simple" tasks, regardless of what the size of the input is, then we would say that it has O(1) time complexity (constant time complexity). Say another program does one "simple" operation over a square, binary matrix of size n by n. Then we say that it always does n2 tasks and its complexity is O(n2 ). If we added the previous example to the end of the program then it would still be O(n2 ) time complexity (we'd call those three appended operations "overhead"). Now, polynomial time is any time complexity of the form O(nk ) for some natural number k. There are more complicated examples such as O(n log n) and other combinations, but since O(n log n) < O (n2 ) you can consider it polynomial time. There could also be multiple inputs, so O(nk , mj , ...) is also a possibility. Polynomial time is important because it's easy (because polynomials are algebraic and comparatively easy to work with). Some examples of programs which are not polynomial time are functions which exhibit exponential time complexity O(2n ), factorial time complexity O(n!), and so on. Programs like these are very slow when n becomes too large. A famous example of this is the Tower of Hanoi. These problems grow so fast that for modestly large input, the time to solve the problem (even with computers) could take years.
🌐
Computational Complexity
blog.computationalcomplexity.org › 2022 › 11 › who-first-thought-of-notion-of.html
Computational Complexity: Who first thought of the notion of Polynomial Time?
November 14, 2022 - While it is true that Cobham defined P in that paper, and he might have been the first one to do so, was the notion somehow around earlier. I first thought the answer was no. Why? Because if you look at Joe Kruskal's paper on MST (see here) you don't see anything resembling time complexity.
🌐
Stack Overflow
stackoverflow.com › questions › 71208201 › polynomial-time-complexity-on
algorithm - Polynomial Time Complexity O(N) - Stack Overflow
Polynomial Time Complexity is usually presented as an upper-bounds limit, so that would mean that only (B) is not in polynomial time complexity.
🌐
Computer Science Field Guide
csfieldguide.org.nz › en › chapters › complexity-and-tractability › polynomial-time
Polynomial Time and Non-polynomial Time - Complexity and Tractability - Computer Science Field Guide
The “NP” in the name stands for “non-deterministic polynomial-time”, which means that it’s part of a class of problems that could be solved by a “non-deterministic” machine (these don’t exist in reality) in polynomial time (that is, a tractable amount of time).
🌐
Dartmouth College
cs.dartmouth.edu › ~deepc › Courses › S09 › Lectures › lecture8.pdf pdf
Computational Complexity 1 Polynomial Time Algorithms
Definition 1.1. A computational problem X is polynomial time reducible to a computa- tional problem Y , if given an algorithm A for the problem Y with time complexity T(|Y |)
🌐
Quora
quora.com › In-complexity-theory-why-are-polynomial-time-algorithms-considered-efficient
In complexity theory why are polynomial time algorithms considered efficient? - Quora
Answer (1 of 5): Often times it is usually in contrast to exponential-time algorithms as this convention of describing efficiency usually relates to how we talk about problems in relation to computational complexity classes like P and NP-complete versus EXP. Having an algorithm that takes O(n^{20...
🌐
Springer
link.springer.com › home › encyclopedia of cryptography and security › reference work entry
Polynomial Time | Springer Nature Link
It is easy to see that the running time will also satisfy the simpler bound ... for a (possibly) larger constant \({{c}^{{\prime}}}_{d}\) and (possibly) larger x. In O-notation, this would be written \(T(x) = O({x}^{d})\). The term “polynomial” comes from the fact that...
🌐
Wikipedia
en.wikipedia.org › wiki › Polynomial_hierarchy
Polynomial hierarchy - Wikipedia
December 1, 2025 - If we omit the requirement of at most k – 1 swaps between the existential and universal states, so that we only require that our alternating Turing machine runs in polynomial time, then we have the definition of the class AP, which is equal to PSPACE. The union of all classes in the polynomial hierarchy is the complexity class PH.