Math 2.0

Computer science Definition

Randomized algorithm

Builds on AlgorithmProbabilistic Turing machineRandom variableExpected value

Definition

A randomized algorithm is an algorithm that, besides its input xx, reads a sequence rr of independent uniformly random bits. Its steps may depend on the values of these bits. For a fixed input xx, its output A(x)A(x) and its running time T(x)T(x) are random variables that depend on rr. Two kinds are standard.

  1. A Las Vegas algorithm always gives a correct output, and its quality is measured by the expected value of T(x)T(x).
  2. A Monte Carlo algorithm has a running time bounded by a function of the input size. It may give a wrong output with bounded probability.

A formal model is the probabilistic Turing machine.

Remarks

Example: randomized quicksort chooses each pivot uniformly at random among the current items. It always returns the sorted list, so it is Las Vegas, and its expected number of comparisons is O(nlog⁡n)O(n \log n) for every input of nn distinct items.

Example: to test whether AB=CAB = C for n×nn \times n matrices, Freivalds' algorithm picks a random vector v∈{0,1}nv \in \set{0, 1}^n and checks A(Bv)=CvA(Bv) = Cv in time O(n2)O(n^2). If AB=CAB = C it always says yes; if AB≠CAB \ne C it says yes with probability at most 1/21/2, so it is Monte Carlo with one-sided error.

Non-example: an algorithm that runs on a fixed pseudorandom seed stored in its code makes no random choices, so it is deterministic.

The error probability of a Monte Carlo algorithm can be reduced by running it several times with independent random bits.

Reading path

To understand this page from the ground up, read these 5 pages in order. The foundations come first.

Show the path as a graph
Each page uses the pages above it. The colour of the bar on a box shows how strong the evidence is, and the box also gives it as text. The list has the same pages.
  • no evidence level
  1. Algorithm concept
  2. Expected value concept
  3. Probabilistic Turing machine concept
  4. Random variable concept
  5. Randomized algorithm definition

Further reading

  1. Web https://en.wikipedia.org/wiki/Randomized_algorithm
About this page
Tag51DJRE9GVH
URIm2://51DJRE9GVH
Kinddefinition
WritingW0 stub
MSC68W20, 68Q87
DefinesRandomized algorithm
UsesAlgorithm, Probabilistic Turing machine, Random variable, Expected value
Changed3 November 2026

Markdown · JSON · Edit on GitHub

What this page needs for W1

  • an inventory row: the row of the inventory that the node accounts for (0 of 1)
  • a source with a locator (0 of 1)

The writing levels say how complete the text of a page is. They do not measure its truth.

What links here

No page links to this page yet.