2.2

## Keio University

Skip to 0 minutes and 4 secondsA so called quantum algorithm generally has five parts. First part of quantum algorithm, we perform classical computation. The classical pre-processing might even involve re-compiling the quantum program to be input data specific. Now, we start the actual quantum part of the algorithm. Firstly initialize the processor or system of qubit to zero. For most algorithms, the next step is to create a superposition of all possible states, we do using Hadamard gate. For example, we prepare three qubits in the zero state and perform Hadamard gates to set those qubits to superposition of 0 and 1. After initialization, quantum computation will progress using an appropriate combination of one and two qubits gates and measurement operations.

Skip to 0 minutes and 57 secondsIn usual case, the amount of entanglement is maximized at the middle part of computation. Classical computer algorithms is often loop until something happens. Each time through the loop, they check to see if they have found the answer. If so, the algorithm can stop. But for quantum algorithms, checking to see if we are done is hard. If we try to see the answer, the quantum state will be destroyed. So quantum algorithms generally run for fixed time. There are some exceptions to this, where the next gate we execute depends on the result of measuring a qubit, but they don’t really affect the overall flow of the algorithm.

Skip to 1 minute and 42 secondsAt the end of this phase, hopefully the algorithm has used interference to make a state that is the solution of the problem. To read the result of computation, we measure the qubits. Through these measurements, qubits become classical states 0 or 1 and the entanglement disappears. Given that most quantum algorithms only probabilistically generate the right answer, the classical post-processing not only involves some additional calculations, it involves confirming that the answer is correct. If not, we probably have to go back to step 1 and repeat.

# Basic Algorithmic Flow

A quantum algorithm generally has five parts. The first part is the classical pre-processing. Next, we initialize the processor or qubit register to zero and create a superposition of all possible states. After initialization, quantum algorithm progress using an appropriate combination of one- and two-qubit gates and measurement operations. To obtain the result of the computation, we measure the qubits. Through these measurements, each qubit’s state becomes a classical 0 or 1 and the entanglement disappears. The classical post processing not only involves some additional calculations, it involves confirming that the answer is correct. If not, we probably have to go back to step one and repeat.