Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learn Quantum Computing with Python and IBM Quantum

You're reading from   Learn Quantum Computing with Python and IBM Quantum Write your own practical quantum programs with Python

Arrow left icon
Product type Paperback
Published in Feb 2025
Publisher Packt
ISBN-13 9781803244808
Length 420 pages
Edition 2nd Edition
Arrow right icon
Author (1):
Arrow left icon
Robert Loredo Robert Loredo
Author Profile Icon Robert Loredo
Robert Loredo
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Exploring the IBM Quantum Tools 2. Creating Quantum Circuits with IBM Quantum Composer FREE CHAPTER 3. Introducing and Installing Qiskit 4. Understanding Basic Quantum Computing Principles 5. Understanding the Qubit 6. Understanding Quantum Logic Gates 7. Programming with Qiskit 8. Optimizing and Visualizing Quantum Circuits 9. Simulating Quantum Systems and Noise Models 10. Suppressing and Mitigating Quantum Noise 11. Understanding Quantum Algorithms 12. Applying Quantum Algorithms 13. Understanding Quantum Utility and Qiskit Patterns 14. Other Book You May Enjoy 15. Index
Appendix A: Resources 1. Appendix B: Assessments

Chapter 11 – Understanding Quantum Algorithms

Question 1

Which algorithm would you use to determine whether an n-bit string is balanced?

Answer

The Deutsch-Jozsa algorithm can be used to determine whether a function is constant or balanced.

Question 2

Implement the Bernstein-Vazirani algorithm to find the state 170.

Answer

To create the circuit, you need the binary representation of 170. Then, after applying a Hadamard gate to all the qubits, except the ancilla qubit, to which you will first apply a NOT gate followed by a Hadamard gate, apply a CX gate to each qubit that is represented by the binary value for 170, which is represented by the value 10101010. So, you would apply a CX gate to each of the odd qubits, where the control of each CX gate should be set to qubit 1, 3, 5, and 7 and the target of each CX gate is the ancilla qubit. Then, apply a Hadamard gate followed by a measurement operator to all qubits except the ancilla qubit.

Question...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime