Questions
- How many qubits do we need to search for something in a list containing 1,000,000 entries? How many steps will the search take?
- Write the matrix of the diffuser to search through an eight-value list.
- Modify the code in this chapter’s Coding Grover’s algorithm with matrices section so that the target is a randomly chosen state between |000⟩ and |111⟩.
- For what values of
x
,y
, andz
is the following expression true?(x | y | ~z) & (x | ~y | z) & (x | ~y | ~z) & (~x | y | z) & (~x | y | ~z) & (~x | ~y | z) & (~x | ~y | ~z)
Legend: |
means or
, ~
means not
, and &
means and
.
- Run the following code:
from qiskit import QuantumCircuit, execute from qiskit import Aer from qiskit.visualization import array_to_latex circ = QuantumCircuit(3) circ.x(2) circ.h(2) circ.barrier() circ.toffoli(0, 1, 2) display(circ.draw('latex')) device = Aer.get_backend('unitary_simulator') job = execute...