Deutsch-Jozsa Algorithm: One Query, Certain Answer

This simulator runs the actual Deutsch-Jozsa circuit on a real amplitude array of size N=2ⁿ: a uniform superposition, an oracle that applies a genuine phase kickback (−1)^f(x) to every basis state where your hidden function outputs 1, and a real Walsh-Hadamard transform back into the computational basis. Nothing about the outcome is pre-baked — build a constant function and the all-zeros amplitude always lands at probability 1; build a balanced one, by random assignment or by parity, and it always lands at exactly 0. Compare that single oracle call against the classical worst case, which needs 2ⁿ⁻¹+1 queries to reach the same certainty.