3.7.19 · D3Algorithm Paradigms

Worked examples — Randomized algorithms — Las Vegas, Monte Carlo

2,563 words12 min readBack to topic

This page is the drill floor for the parent topic. The parent taught you two machines: Las Vegas (always right, random time) and Monte Carlo (fixed time, maybe wrong). Here we don't teach new theory — we throw every kind of input at those two machines and watch what happens, so no exam case can surprise you.

Before we compute anything, one promise: every symbol you see below was already earned in the parent note. If you feel a gap, the linked prerequisite fills it:

  • = success probability of one trial → Probability and Expectation
  • = expected value (long-run average) → Probability and Expectation
  • boosting and → used in Chernoff Bounds and Markov's Inequality

The scenario matrix

Every randomized-algorithm question lives in one of these cells. Think of the two axes as: which machine (Las Vegas / Monte Carlo) and what weird thing the input does (extreme probability, zero, one-sided vs two-sided, real-world, exam twist). We will hit all ten cells.

Cell Machine Scenario class Covered by
C1 Las Vegas Ordinary retry loop Ex 1
C2 Las Vegas Limiting: (almost never retry) and (blows up) Ex 2
C3 Las Vegas Degenerate — never succeeds Ex 2
C4 Monte Carlo One-sided error, choose for a target Ex 3
C5 Monte Carlo Extreme tiny success (Karger-style) Ex 4 (figure)
C6 Monte Carlo Two-sided error — majority vote, why last-run fails Ex 5
C7 Conversion LV → MC via a time budget + Markov Ex 6
C8 Conversion MC → LV via cheap verification Ex 7
C9 Real-world Word problem (server / dice framing) Ex 8
C10 Exam twist "Which class is it?" mis-labelled algorithm Ex 9

Worked examples


Recall Quick self-test

A retry loop succeeds with . Expected trials? ::: . One-sided MC wrong w.p. ; error after rounds is below? ::: . Two-sided error per run, best-of-5 wrong prob? ::: . Budget , overrun bound by Markov? ::: . "Output can be wrong" → which class? ::: Monte Carlo.