Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say that I magicked up some algorithm that would solve subset sum problem in polynomial time, if and only if the input set N was roughly uniformly distributed. Would that count as a polynomial solution, in the general case? Or does a general-case solution have to deal with any distribution?

share|cite|improve this question
up vote 3 down vote accepted

Normally, the complexity classes (such as polynomial-time) are dealing with worst-case complexity. In particular, the P?=NP question deals with worst-case complexity. However, average-case behaviour (with respect to some probability distribution) is often of considerable practical interest.

One difficulty is that the reduction of one problem to another usually does not respect the probability distribution. Thus a (worst-case) polynomial-time algorithm for subset sum could be used to provide polynomial-time algorithms for all the other NP problems, e.g. graph colouring, because a graph colouring problem can in principle be transformed into a subset sum problem in such a way that solving that subset sum problem in at most time $T$ would solve the graph colouring problem in at most time $p(T)$ for some polynomial $p$. But an average-case polynomial-time algorithm for subset sum would be unlikely to help much with, say, graph colouring: the subset sum problem you would get from a "typical" graph colouring problem would not be a "typical" subset sum problem.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.