What a query advantage does and does not mean

Deutsch–Jozsa looks exponential but a randomised classical algorithm solves it in a few queries. Here is the honest reading of all three results.

9 min read · reviewed December 2026

The randomised classical answer to Deutsch–Jozsa

The exponential cost of Deutsch–Jozsa applies to a classical algorithm that must be certain. Allow a small chance of error and the picture changes. Query k distinct random inputs. If the answers differ, f is balanced for certain. If they all agree, guess constant. The only way to be wrong is for a balanced function to return the same bit k times in a row.

That chance is at most 2^(1−k), and it falls quickly. The table gives exact values from the product formula. After ten queries the chance of error is below 0.2 percent for every n, and after twenty it is below two in a million.

Chance that k distinct classical queries to a balanced function all return the same bit. Exact product formula.
kn = 3n = 4n = 5n = 6
1100.000%100.000%100.000%100.000%
242.857%46.667%48.387%49.206%
314.286%20.000%22.581%23.810%
42.857%7.692%10.122%11.319%
50 (certain)2.564%4.338%5.282%
80 (certain)0.016%0.245%0.475%
90 (certain)0 (certain)0.082%0.204%

So what does Deutsch–Jozsa show?

It shows a gap between a quantum algorithm and a deterministic classical one with zero error. That is a real mathematical difference, and it was the first of its kind. It does not show a practical speed-up, because a randomised classical algorithm with a tiny error rate nearly matches it. This is why the later problems in the lab matter more.

Bernstein–Vazirani and Simon are stronger

  • Bernstein–Vazirani: any classical algorithm, randomised or not, needs about n queries, because each query reveals one bit and the secret has n bits. The gap is n against 1.
  • Simon: any classical algorithm that errs with small probability needs exponentially many queries, about 2^(n/2). The quantum algorithm needs about n. This is an exponential separation that survives randomisation.

What no query result says

  • It does not say the oracle is cheap. You must build the oracle as a circuit, and its size counts in real time.
  • It does not say the same advantage exists for a problem with no oracle. Real problems come with their own structure and their own best classical algorithms.
  • It does not say today’s hardware can run the circuit at useful sizes. These circuits are small and are easy to run on a simulator. Hardware needs error control to scale them.
  • It does not say the promise holds in practice. Outside the promise the answer is not guaranteed.

A query advantage is a clean proof that quantum computation can differ from classical in a model. It is not a forecast about any product.

Why teach them anyway

These three algorithms are the cleanest places to see the ingredients of larger ones: superposition over inputs, phase kickback, and interference through a Hadamard layer. Simon’s idea of finding a hidden period by sampling and solving linear equations leads straight to Shor’s algorithm. Learning the small cases makes the large ones readable.

Try it

Questions

Is Deutsch–Jozsa useless, then?

It is not a practical algorithm, but it is a clear teaching case and the historical first example of a quantum advantage in a model.

Which of the three is the strongest result?

Simon’s, because the separation is exponential even against randomised classical algorithms.

Read next

Sources and further reading

Check the original sources for exact citations.