Compute-phase-uncompute construction
= Compute-phase-uncompute construction
Starting the answer qubit in $|0\rangle$, the sequence
$$
U_f,\qquad Z,\qquad U_f
$$
maps $|x\rangle|0\rangle$ to $(-1)^{f(x)}|x\rangle|0\rangle$. It realizes a phase oracle with two standard-oracle queries while returning the answer register to its initial state.