In complexity theory, ZPP (Zero-error Probabilistic Polynomial time) is the complexity class of problems for which a probabilistic Turing machine exists with these properties:
In other words, the algorithm is allowed to flip a truly-random coin while it's running. It always returns the correct answer. (Such an algorithm is called a Las Vegas algorithm.) For a problem of size n, there is some polynomial p(n) such that the average running time will be less than p(n), even though it might occasionally be much longer.
Alternatively, ZPP can be defined as the class of problems for which a probabilistic Turing machine exists with these properties:
The definition of ZPP is based on probabilistic Turing machines. Other complexity classes based on them include BPP and RP. The class BQP is based on another machine with randomness: the quantum computer.
The class ZPP is exactly equal to the intersection of the classes RP and Co-RP. This is often taken to be the definition of ZPP. To show this, first note that every problem which is in both RP and co-RP has a Las Vegas algorithm as follows:
Note that only one machine can ever give a wrong answer, and the chance of that machine giving the wrong answer during each repetition is 50%. This means that the chance of reaching the kth round shrinks exponentially in k, showing that the expected running time is polynomial. This shows that RP intersect co-RP is contained in ZPP.
To show that ZPP is contained in RP intersect co-RP, suppose we have a Las Vegas algorithm C to solve a problem. We can then construct the following RP algorithm:
The class P is contained in ZPP, and some computer scientists have conjectured that P=ZPP: i.e. every Las Vegas algorithm has a deterministic polynomial-time equivalent.
It is still open whether ZPP = EXPTIME (though that is almost certainly false). The result P=ZPP would disprove this, as P ≠ EXPTIME (see time hierarchy theorem).