7

Computational Complexity Theory is complex. My understanding of polynomial time is in relation to other time complexity classes, such as non-deterministic polynomial time. This is fine for engineers and mathematicians, but I'm looking for a simple definition of the term, suitable for laypeople.

  • Would it be incorrect to cast polynomial time as "time measured in (computational) operations?"

Obviously there would be subsequent qualifications for different time complexity classes, and time complexity may be more properly a ratio based on the problem size, but again, that's a bit more complex than what I'm looking for here.

Raphael
  • 73,212
  • 30
  • 182
  • 400
DukeZhou
  • 249
  • 2
  • 9

4 Answers4

40

Polynomial time algorithms are algorithms whose running time increases by a constant factor when the input is doubled in size.

Exponential time algorithms are algorithms whose running time increases by a constant factor when the input size increases by 1.

For laypeople you can perhaps identify NP-complete problems with problems solvable only in exponential time, although, as we know, this is wrong on many counts.

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
37

Would it be incorrect to cast polynomial time as "time measured in (computational) operations?"

Yes. Completely incorrect.

"Time" does indeed mean "time measured in (computational) operations" but you've not translated "polynomial" at all. It's like translating "twelve days" as "time measured in number of rotations of the earth on its axis." That's exactly what what "day" means, but what happened to "twelve"?

Polynomials are inherently mathematical objects and I doubt there's any way of explaining them without using mathematics. You can explain that polynomial algorithms are usually regarded as being reasonably efficient, but that's a consequence of what a polynomial relationship is, not an explanation of it.

David Richerby
  • 82,470
  • 26
  • 145
  • 239
9

"Polynomial time" is a statement about the running time of an algorithm. In theory, the running time of an algorithm is a count of the number of basic operations it does. This is expected to be proportional to the time it takes for the algorithm to run on a computer. Polynomial time means that the running time is at most some (unspecified) polynomial in the size of the input; e.g., proportional to the square of the input size, or cube, or something like that. Polynomial-time algorithms are often efficient enough to implement in practice.

See https://en.wikipedia.org/wiki/Time_complexity#Polynomial_time and https://en.wikipedia.org/wiki/Cobham%27s_thesis.

D.W.
  • 167,959
  • 22
  • 232
  • 500
1

There's really not much you can do to provide simple definitions of those problem spaces. Remember that problem spaces like P and NP are defined by asymptotic behavior as some number n goes to infinity. There are no layman situations where going to infinity is useful, and the precision needed to define it that way is brutal.

As such, I find its easiest to describe P and NP as "fast" and "slow," and then use the practical example of cryptography because it's interesting to people. I start with NP (because there are fast and slow P algorithms, so I want to anchor their concept of "slow" to that of exponential time before bringing in P). Everyone has dealt with some sort of geometric growth somewhere, even if its just compound interest, so there's something to start from.

Once I think they have some idea of exponential time, I introduce the cryptography link. One of the goals of cryptography is that adding 1 bit to a key doubles how long it takes someone to break it. The essential part is to connect the idea that adding work to the sender/receiver multiplies the amount of work needed by the attacker.

With that, I can then bring up Moore's law, which very roughly says computing power doubles every 18 months. That means my attacker is able to do twice as much work if he can wait for the hardware to catch up. When his attacking capability doubles, I have to add a bit. Then he doubles again, and I add a bit. Then I can show just how asymmetric this game is -- every time they do a massive amount of extra work, I have to do just a little extra work to keep things even.

Now I can teach polynomial time as algorithms that run faster than exponential time. This is a bit of a simplification, but for a layman I think it's okay. If my crypto algorithm were polynomial time, as my attacker's computational speed got better, I'd have to be adding bits quicker and quicker, bogging down the system. Everyone knows what it means when a computer runs slow!

Cort Ammon
  • 3,522
  • 14
  • 16