Sign in
← Atlas
Strong empiricalAlgorithmsAmplitude amplification

Grover unstructured search

The canonical search primitive, paired with the linear classical baseline it is meant to improve.

searchoracleamplitude amplificationquery complexity

Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.

Grover amplifies the amplitude of marked states using an oracle and a diffusion step. It is useful for testing whether a claimed speedup includes oracle construction and readout costs.

Circuit & simulation
Marked state75%
What this takes and returns
TakesNothingWhat joins here

No input port at this edge: the record publishes no gate sequence and no register, so there is nothing here to read one off — and unlike a declared hole, nothing has been recorded about what belongs here.

Nothing in the Atlas meets this end.

ReturnsNothingWhat joins here

No output port at this edge: the record publishes no gate sequence and no register, so there is nothing here to read one off — and unlike a declared hole, nothing has been recorded about what belongs here.

Nothing in the Atlas meets this end.

This record publishes no gate sequence and no register, so there is nothing here to read an interface off. Absent rather than empty. See all 152 →

Where this sits

This record is named by the layer graph at:

  • Fixed-iteration amplitude rotation Method

    Takes A check evaluable in superposition on any candidate, the size of the domain it ranges over, and the promise that fixes the schedule — Grover assumes exactly one accepted candidate; a method may instead require the check to answer about partial commitments rather than whole candidates. Returns One accepted candidate, with the number of queries spent and the probability the answer is right — or the report, at a stated confidence, that the domain holds none.

How it works

For an unstructured search space of size NN with a single marked item, Grover's algorithm reaches the marked state with high probability using O(N)O(\sqrt N) oracle queries, versus O(N)O(N) expected queries for classical exhaustive search — a quadratic query-complexity separation, not a claim about wall-clock time on any given hardware. The construction alternates an oracle UfU_f that flips the sign of the marked amplitude with the diffusion operator 2ssI2|s\rangle\langle s|-I; each pass rotates the state by 2θ2\theta (where sinθ=1/N\sin\theta=1/\sqrt N) toward the marked subspace, and the success amplitude after kk iterations is sin((2k+1)θ)\sin\big((2k+1)\theta\big), so overshooting past the optimal kπ4Nk\approx\frac{\pi}{4}\sqrt N actually reduces success probability. This record's two-qubit (N=4N=4) toy oracle and diffusion layer are checked against the ideal circuit — small-instance evidence for the construction — while the O(N)O(\sqrt N) asymptotic claim rests on the cited literature and assumes a coherent oracle where oracle calls, not classical readout, dominate cost.

Implementation
Native
grover_search.py
from qiskit import QuantumCircuit

qc = QuantumCircuit(2)
qc.h([0, 1])
# Oracle marks one basis state.
qc.cz(0, 1)
qc.h([0, 1])
qc.x([0, 1])
qc.cz(0, 1)
qc.x([0, 1])
qc.h([0, 1])

FINAL_CIRCUIT = qc

The oracle is intentionally small so the circuit can be inspected. Scaling claims belong to the cited query-complexity result.

Quantum vs classical
MetricClassicalQuantum
Query complexityO(N)O(√N)
Queries (1 of N marked)~N/2 avg⌊(π/4)√N⌋
Register (N = 2ⁿ)n bitsn qubits
Asymptotic speedupbaselinequadratic

Classical baseline

Linear scan or a classical indexed data structure, depending on whether the oracle is already available.

Quantum claim

Quadratic improvement in oracle queries for an unstructured search problem.

How to compare

Include oracle synthesis, state preparation, error correction, measurement repetitions, and data-loading costs before calling it an application speedup.

Declared gaps

Nobody has reviewed this record for gaps yet.

Literature & references
A fast quantum mechanical algorithm for database search1996 · Lov K. Grover

Original search algorithm and the O(√N) query comparison with classical search.

arxiv.org/abs/quant-ph/9605043