← all labs

Grover's Quantum Search Algorithm

Search an unsorted database of N items in O(√N) steps instead of O(N). Start with equal superposition, then alternately: (1) Oracle flips the target's amplitude sign, (2) Diffusion operator inverts amplitudes about the mean — amplifying the target.

Iteration 0 — initial uniform superposition

Optimal: ⌊π√N/4⌋ iterations. After that, probability decreases — measuring too late is just as bad as too early. Classical: N/2 expected queries. Quantum: π√N/4 ≈ O(√N) — a provable quadratic speedup.