The development of programming languages for quantum computing has increased rapidly over the last few years, making it practical for a hands-on approach in teaching quantum computation. In this paper, I introduce the standard textbook example of searching for one item out of four using Grover's search algorithm and extend it by including a quantum database. In addition to explaining how to include a quantum database using a quantum circuit model, I give a complete program implementing the algorithm written in the quantum computing language Qiskit from IBM. If presented in the classroom, this extension of Grover's search algorithm alleviates some unsatisfying aspects of the standard textbook example. If given as an exercise to students, it allows them to extend the standard example and provides experience in developing quantum algorithms. I also outline searching for one (or more) items out of eight with a quantum database, which could be used for student projects.

1.
L. K.
Grover
, “
A fast quantum mechanical algorithm for database search
,” in
Proceedings of 28th Annual ACM Symposium on the Theory of Computation
(
1996
), p.
212
; e-print arXiv:quant-ph/9605043.
2.
L. K.
Grover
, “
Quantum mechanics helps in searching for a needle in a haystack
,”
Phys. Rev. Lett.
79
,
325–328
(
1997
); e-print arXiv:quant-ph/9706033.
3.
M.
Boyer
,
G.
Brassard
,
P.
Hoyer
, and
A.
Tapp
, “
Tight bounds on quantum searching
,”
Fortsch. Phys.
46
,
493–506
(
1998
); e-print arXiv:quant-ph/9605034.
4.
M. A.
Nielsen
and
I. L.
Chuang
,
Quantum Computation and Quantum Information
(
Cambridge U.P
.,
Cambridge
,
2000
).
5.
G.
Benenti
,
G.
Casati
,
D.
Rossini
, and
G.
Strini
,
Principles of Quantum Computation and Information: A Comprehensive Textbook
(
World Scientific
,
London
,
2019
).
6.
D. N.
Mermin
,
Quantum Computer Science
(
Cambridge U.P
.,
Cambridge
,
2007
).
7.
J. A.
Jones
and
D.
Jaksch
,
Quantum Information, Computation and Communication
(
Cambridge U.P
.,
Cambridge
,
2012
).
8.
11.
P. M.
Alsing
and
N.
McDonald
, “
Grover's search algorithm with an entangled database state
,”
Proc. SPIE
8057
,
80570R
(
2011
).
12.
B.
Broda
, “
Quantum search of a real unstructured database
,”
Eur. Phys. J. Plus
131
,
38
(
2016
); e-print arXiv:1502.04943[quant-ph].
13.
A subtlety in deriving 2.25 is that if you do not find the target index on the third query, you know the answer without querying a fourth time.
14.
Learn quantum computation using qiskit, <http://qiskit.org/textbook>.
15.
D.
Koch
,
L.
Wessing
, and
P. M.
Alsing
, “
Introduction to coding quantum algorithms: A tutorial series using Qiskit
,” e-print arXiv:1903.04359 [quant-ph].
16.
C.
Lavor
,
L. R. U.
Manssur
, and
R.
Portugal
, “
Grover's algorithm: Quantum database search
,” e-print arXiv:quant-ph/0301079.
17.
N. S.
Yanofsky
and
M. A.
Mannucci
,
Quantum Computing for Computer Scientists
(
Cambridge U.P
.,
Cambridge
,
2008
).
AAPT members receive access to the American Journal of Physics and The Physics Teacher as a member benefit. To learn more about this member benefit and becoming an AAPT member, visit the Joining AAPT page.