Tutorial10 Solution
Tutorial10 Solution
(a) Discuss how a classical computer (with a CPU and a memory) would approach this problem. How many queries
to the memory are required on average? What is the worst-case scenario?
Now imagine we are given a “quantum processing unit” (QPU) containing four registers:
• An n qubit register for the database index.
With this QPU, we can perform the following load operation: for an index x
LOAD
|xi |si |ti |−i 7→ |xi |si |t ⊕ dx i |−i .
In particular, for |ti = |0i the third register will contain |dx i. Then, the second and the third register are compared
and, if they are the same, a bit flip is applied to the forth register.
(b) What is the effect of this operation? What is its connection to Grover’s algorithm?
Solution
(a) The CPU must have enough memory to store a bit string of length n. One can then iterate through the indexes
of the database entries. Each entry, dx , is loaded from the memory into the CPU and the condition dx = s is
checked until satisfied. On average, this would require N/2 queries to the memory. The worst case scenario is
when s is the very last item checked, i.e., one performs N queries.
1 M. A. Nielsen, I. L. Chuang: Quantum Computation and Quantum Information. Cambridge University Press (2010), section 6.5
1
(b) A conditional bit flip on the forth register results in
(
|xi |si |dx i √12 (|1i − |0i) = − |xi |si |dx i |−i , if s = dx
|xi |si |dx i |−i 7→
|xi |si |dx i |−i otherwise
One can then perform the load operation again to reset the third qubit to zero, since |dx ⊕ dx i = |0i. In
summary, when the second and third register are the same, a phase of √ −1 is introduced. This is precisely the
oracle in Grover’s algorithm. Grover’s algorithm will then only need O( N ) such load and flip operations.
(c) Given that quantum states are very sensitive to noise, for long term storage it is preferable to use classical
hardware.
(d) Unstructured databases are not common. Typically, the database is designed with some kind of structure to
optimize the number of queries to memory needed (e.g., by storing items in alphabetical order). In terms of
hardware, the quantum addressing scheme depicted above uses O(N log(N )) “switches” to send the input
qubit left or right. At this point in time, such a setup would be too expensive, and not advantageous compared
to distributed classical computing approaches.