Coding the DJ Algorithm
Let’s code the circuit for the Deutsch-Jozsa algorithm.
Before we formally present the code for the Deutsch-Jozsa (DJ) algorithm, let’s go back to the start of this chapter, where we covered oracles. The astute reader would have noticed that the DJ algorithm creates an oracle when defining this function . In fact, we packaged the functionality of within a black box that we queried with superposition and received outputs from. We measured those outputs to reveal something about the nature of the oracle, as we stipulated that we would when we first read about oracles.
This creation of oracles and then querying them is a powerful technique in quantum computing, and many other algorithms use it. But before diving ...