Random/randomized algorithms
An algorithm is a “black box” that receives a collection of bits (input) and yields a collection of bits (output)
In addition to that, a randomized algorithm receives an infinite random string of bits that is used to make randomized decisions (random,
| Deterministic | Random Variable | |
|---|---|---|
| Deterministic | Deterministic algorithms | Monte-Carlo algorithms |
| Random Variable | Las Vegas algorithms | Atlantic City algorithms |
Las Vegas (LV) algorithms
Monte Carlo (MC) algorithms
Verifying BMM
Input
Output
Naive solution
Monte-Carlo algorithm
Let us first try to solve this problem in
An improvement of this algorithm (an amplification of probability) would be to simply run this algorithm multiple times, independently (why?) How many times is enough?
Paranoid QuickSort (Las Vegas)
Let us augment the classic QuickSort to always choose a “good” pivot, meaning that