Algorithm

Deutsch-Jozsa

Problem: decide whether a hidden Boolean function is constant or balanced in a toy setting.

Run in Simulator

Expected output

01

The balanced sample should favor measuring 1 on the query qubit.

Core intuition

The oracle writes information into phase, then the final H converts it into a measurable bit.

Visual circuit

Prepare, query with CX, unprepare, then measure q0.

Significance

It is a clean first example of phase kickback and query advantage.

Limit

This demo is educational, not a practical workload.

Circuit DSL

# Deutsch-Jozsa (balanced oracle f(x)=x xor 1)
qubits 2
H 0
X 1
H 1
CX 0 1
H 0
H 1
MEASURE 0

Challenge

What does the final H help reveal?