A Las Vegas algorithm is an algorithm that runs in
polynomial time and produces an answer with probability
;
alternatively, it may say ``don't know.'' Whenever an answer
is produced, it is guaranteed to be correct. By repeating
the algorithm
times using independent coin flips,
the probability of not getting an answer is reduced to
.
A Monte Carlo algorithm with one-sided error
runs in polynomial time and it produces a
correct answer with probability
. The primality tests
discussed in the previous class are examples
of Monte Carlo algorithms with one-sided error, i.e.,
the answer ``
is composite'' is always correct
but ``
is prime'' may be an incorrect answer;
the probability that a composite
is misclassified
as prime is less than
(after
repetitions).