Classical against quantum query counts: reading the scaling table
How many oracle calls each problem needs as n grows, with the exact formulas used by the lab and the one place where an estimate replaces an exact count.
8 min read · reviewed December 2026
The three counts
Deutsch–Jozsa classical cost is 2^(n−1) + 1 for a guaranteed answer. Bernstein–Vazirani classical cost is n queries when the offset is known and n + 1 when it is not. Simon classical cost grows like 2^(n/2). The quantum costs are 1, 1 and about n − 1 plus a small constant respectively.
| n | DJ classical (guaranteed) | BV classical (b = 0) | Simon classical (about 2^(n/2)) | Simon quantum (expected runs) |
|---|---|---|---|---|
| 4 | 9 | 4 | 4 | 4.48 |
| 8 | 129 | 8 | 16 | 8.60 |
| 16 | 32,769 | 16 | 256 | 16.61 |
| 24 | 8,388,609 | 24 | 4,096 | 24.61 |
| 32 | 2,147,483,649 | 32 | 65,536 | 32.61 |
Exact versus estimated
- Deutsch–Jozsa classical: exact worst case. A balanced function can hide behind 2^(n−1) equal answers.
- Bernstein–Vazirani classical: exact lower bound of n, since each answer is one bit and the secret has n bits.
- Simon classical: an order of growth, not an exact count. The lab shows a union-bound estimate: k queries make k(k−1)/2 pairs, each equal to s with chance 1/(2^n − 1), so the chance of a hit is at most that ratio. This page’s own arithmetic.
- Simon quantum: an exact expected value of runs under the uniform model, from the sum in the Simon guide.
Reading growth, not size
At n = 32 the Deutsch–Jozsa classical count is over two billion queries and the quantum count is one. That makes a dramatic table, but remember that the model charges nothing for the oracle. A 32-bit oracle that must also be run in superposition is a circuit with its own cost.
The gap that matters most for the history of the subject is Simon’s. It is exponential, it holds against any classical algorithm that errs with small probability, and its mechanism generalised. The Deutsch–Jozsa gap is exponential only against deterministic classical algorithms, as the next guide explains.
Using the slider
In the lab’s Query counts tab, drag n from 2 to 40. The Deutsch–Jozsa row doubles with each step. The Bernstein–Vazirani row climbs by one. The Simon row grows by a factor of about 1.41 per step, the square root of two. Those three growth rates, exponential, linear and square-root-of-exponential, are the real content of the table.
Try it
Questions
Why is Simon’s classical cost not exact?
It depends on the search strategy and on the function. The 2^(n/2) figure is the standard order of growth for random search, not an exact formula.
Are these counts the speed-up of a real computer?
No. They count oracle calls only. Real speed-ups depend on the cost of building and running the oracle and on the hardware.
Read next
Sources and further reading
- D. Deutsch, “Quantum theory, the Church–Turing principle and the universal quantum computer” (1985)
- D. Deutsch and R. Jozsa, “Rapid solution of problems by quantum computation” (1992)
- R. Cleve, A. Ekert, C. Macchiavello and M. Mosca, “Quantum algorithms revisited” (1998)
- E. Bernstein and U. Vazirani, “Quantum complexity theory” (1993, journal version 1997)
- D. Simon, “On the power of quantum computation” (1994)
- M. Nielsen and I. Chuang, Quantum Computation and Quantum Information, section 1.4
Check the original sources for exact citations.