Educatifu
Open menu

Grover's search — a first real algorithm

Grover's algorithm finds a marked item in an unsorted list of N in about √N steps instead of N — a concrete, intuitive example of interference doing real work.

CoreQuantum Computing~14 min

Before this lesson

  • Lesson: Interference — the real engine

Time to see interference earn its keep. Suppose you have an unsorted list of N items and exactly one is "marked" — you can recognise it when you see it, but you have no index, no order, nothing to exploit. Classically, you have no choice but to check items one by one; on average that takes about N/2 checks, and N in the worst case.

Grover's algorithm finds the marked item in about √N steps. For a million items, that is roughly a thousand steps instead of a million — a quadratic speedup, and it applies to an enormous class of "search the haystack" problems.

How it works, intuitively

Start by using Hadamard gates to put the register into an equal superposition of all N possibilities — every item has the same small amplitude. Now repeat two moves:

  1. Mark (the oracle). Flip the phase of just the marked item's amplitude, turning it negative. Nothing else changes, and — being only a phase — a measurement still couldn't tell the difference yet.
  2. Amplify (the diffusion step). Reflect every amplitude about the average amplitude. Because the marked item is now below the average (it went negative), this reflection makes it grow while the others shrink slightly.

Each pass nudges more amplitude onto the marked item. After about √N repetitions its amplitude is close to 1 — and now a measurement returns it with high probability. That is destructive interference (draining the wrong items) and constructive interference (building up the right one), exactly as the last lesson promised.

Knowing when to stop

A quantum quirk: you can over-cook it. Keep applying Grover iterations past ~√N and the amplitude overshoots and starts shrinking again — the amplitude is rotating, and you want to stop when it points at the target. So the algorithm runs a precise, pre-calculated number of steps, then measures once.

Its place in the landscape

Grover's speedup is "only" quadratic, not the exponential leap that makes headlines. That distinction matters: the exponential speedups (like Shor's algorithm for factoring, which threatens today's public-key cryptography — see the Cyber Security track) rely on deep structure in the problem, while Grover's needs no structure at all, which is why it is so broadly applicable. Together they map the two ways quantum computers win: exploit hidden structure for a huge win, or amplify a needle in any haystack for a steady one. With gates, circuits, interference and a real algorithm in hand, you now have a working model of how quantum computation actually computes.

Key takeaways

  • Grover's search finds a marked item among N in ~√N steps — a quadratic speedup over classical brute force.
  • It works by repeatedly "marking" the target with a phase flip, then amplifying its amplitude via a reflection.
  • It is not exponential like Shor's algorithm, but it is broad — it speeds up any unstructured search.

← All Quantum Computing lessons

Bring us the problem, not a perfect specification

Tell us what needs to change, who it affects and any important deadline. We will review the context and reply with useful next questions.

  1. 01Share contextDescribe the workflow, constraint or risk.
  2. 02Clarify togetherWe identify missing facts and useful options.
  3. 03Choose a startAgree a focused assessment or delivery step.
Start a conversation