Randomized Algorithms-April 2023-Handouts
Randomized Algorithms-April 2023-Handouts
Algorithms
Output is decided by not only input but also using random number, also
called as probabilistic algorithms
Las Vegas is an internationally renowned major resort city, known primarily for its
GAMBLING, shopping, fine dining and entertainment, in Nevada state of USA- wiki
Laszlo Babai ,1979, is associated with Las Vegas and name the algorithm due to
randomness in gambling specifically, independent coin flipping experiment.
Monte Carlo is a famous casino in the costal area of France called Monaco. It is a
GAMBLING and entertainment complex-wiki
Invented by in 1947 by Nicholas Metropolis and named it due to randomness in
gambling in casino.
Types of randomized Algorithms
Las Vegas algorithm Monte Carlo Algorithm
It gives correct results or informs about Result may be incorrect with small
the failure to find solution. probability
Expected runtime may differ depending on Running time is certain or fixed
input but it is always finite.
Asquare = (2r * 2r ) = 4r 2
• Draw a circle inside the square
with radius r r
2
Acircle = π * r 2r
• The ratio of area of circle to the
area of square is then
Acircle π * r 2 π
= 2
=
Asquare 4 * r 4
Estimating value of Pi using Monte Carlo simulation
Acircle π
=
Asquare 4
Multiplying both sides by 4 yields
Acircle π
4× = 4×
Asquare 4
Acircle
4× =π
Asquare
Acircle
∴π = 4 ×
Asquare
Estimating value of Pi using Monte Carlo simulation
• Draw many points randomly selected within the square, then,
the ratio can be approximated by
Acircle Number of points within the circle
≈
Asquare Number of points within the square
Acircle
π = 4×
Asquare