cho.sh
Las Vegas Algorithm

Las Vegas Algorithm

Warning

Over a year old. May be outdated

A Las Vegas algorithm is a randomized algorithm that always produces a correct result or outputs that it has failed to find a solution. Randomness comes into play regarding the time taken to get a result. Unlike the , which may produce incorrect results with a certain probability, a Las Vegas algorithm guarantees that the result it gives is correct.

An illustrative example is the Quickselect algorithm, a cousin of the Quicksort algorithm. Quickselect finds the kk-th smallest element of an unordered list. While it uses randomness to achieve its expected runtime, it always provides the correct element as an answer.

Las Vegas always gives the correct results but sometimes gives a very slow answer. You bet (risk) time in exchange for a promise of accurate results. Another fun property in Computational Theory.

Backlinks2