Checkpoint: Query Complexity
This checkpoint consolidates the module's query-complexity thread by putting four canonical black-box problems side by side and computing, for each, the quantum and classical query counts. The point is to read off the shape of the speedup — quadratic, exponential, or none — and to see why structure in the oracle is what determines it.
The four problems
| Problem | Promise / task | Quantum queries | Classical (worst case) | Speedup | |---|---|---|---|---| | Deutsch–Jozsa | constant or balanced; decide which | | | exponential | | Bernstein–Vazirani | ; find | | | linear constant | | Simon | ; find period | | | exponential | | Grover | one marked item; find it | | | quadratic |
For the exercise we fix , so .
Where each number comes from
Deutsch–Jozsa. A single query to the phase oracle, sandwiched by Hadamards, maps the all-zeros input to a state that is iff is constant. One quantum query decides it exactly. Classically, a deterministic algorithm could see up to equal values and still not know (a balanced function could agree on the first half); it needs queries in the worst case to be certain — for . This is the first exponential separation, albeit only for exact (zero-error) computation; with randomness the classical gap shrinks.
Bernstein–Vazirani. Here the same one-query Hadamard sandwich returns the entire hidden string at once: the final measurement yields with certainty. Classically each query reveals a single bit, so queries are needed and sufficient. The separation is versus — modest, but a clean illustration of extracting global information in one shot.
Simon. The exponential speedup that directly inspired Shor. Each quantum query yields a random vector orthogonal to the hidden period ; after queries one has independent constraints and solves a linear system over for . Classically, finding a collision requires probing inputs by the birthday bound — queries for — and this is a proven lower bound, making Simon an unconditional exponential separation in the query model.
Grover. As derived earlier, and the optimal iteration count is , which for is (close to ). Classically a deterministic search needs queries in the worst case. The ratio vs reflects the vs quadratic gap.
Try it
Fix () and compute, from first principles, the quantum and classical query counts for all four
problems, plus two booleans: whether Grover's speedup is quadratic (classical quantum) and
whether Simon's is exponential. return the object
{ N, groverQ, groverC, djQ, djC, bvQ, bvC, simonQ, simonC, groverSpeedupIsQuadratic, simonSpeedupIsExponential }.
Sign in on the full site to ask questions and join the discussion.