I understand the Algorithm but can't seem to find how it's implemented in real life? Anyone have any examples for a better understanding?
Asked
Active
Viewed 1,498 times
-2
-
1On a side note, I don't understand why my (and many other peoples) questions get downvoted. I follow all of the question guidelines. – TomD Sep 22 '18 at 17:02
-
Example: `Get random prime number`: `while true: sample random-number; if prime(random-number): return random-number`. This will never fail, but the runtime is theoretically unlimited. In some variation, this is used in asymmetric cryptography without people noticing it. Also make sure to process wiki's comment (see your tag montecarlo): Las Vegas algorithms can be *contrasted* with Monte Carlo algorithms – sascha Sep 22 '18 at 17:08
-
1https://www.quora.com/What-are-some-examples-of-the-Monte-Carlo-and-Las-Vegas-algorithm, found by googling `"las vegas algorithm" examples`. In answer to your side note comment: I'm not your downvoter, but hovering over the down-pointing vote button below the score produces a pop-up that says "This question does not show any research effort; it is unclear or not useful". Evidently somebody thought that applies. – pjs Sep 22 '18 at 18:12
-
Another thing which might make the question clearer is offering a one-sentence explanation of what you mean by "the Las Vegas algorithm" in this context. As normally used, the phrase "Las Vegas algorithm" refers not to a single algorithm but rather a feature of a variety of otherwise unrelated algorithms. Similarly, there are "dynamic programming algorithms", "greedy algorithms", "Monte Carlo algorithms", and so on; in none of these cases would it be meaningful to speak of "the X algorithm" as though there were only one such thing.) – rici Sep 22 '18 at 20:02
1 Answers
2
As Wikipedia says in its article about Las Vegas algorithms, a simple example of a Las Vegas algorithm is randomised quicksort; another simple example is rejection sampling. A more complicated example (linked from the NIST Dictionary of Algorithms site) is an algorithm for finding an order-preserving minimal perfect hash, published in 1992 by Czech, Havas and Majewski.
Another example with a certain amount of practical implementation is the cuckoo hash insertion algorithm
(For reference, a Las Vegas algorithm is a kind of randomised algorithm which is guaranteed to produce a correct answer when it terminates, but which is not guaranteed to terminate in any fixed timespan. Useful Las Vegas algorithms offer good expected running time.)

rici
- 234,347
- 28
- 237
- 341