Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Log inSign up
Challenges
Datasets
Workspaces
Papers
Discussions
Leaderboard
Blog
Job Board
Q3AS

© 2026 Aqora Quantum S.A.S.

TermsPrivacyLegal Notice

Buletinul Institutului Politehnic din Iaşi. Secţia Electrotehnică. Energetică. Electronică

Implementation of the Bernstein-Vazirani Quantum Algorithm Using the Qiskit Framework

Alexandru-Gabriel Tudorache, Vasile Manta, Simona Caraiman

Published Jun 1, 2021• 2 citations
Publisher

Abstract

Abstract This paper describes the basics of quantum computing and then focuses on the implementation of the Bernstein-Vazirani algorithm, which can be seen as an extension of the Deutsch-Josza problem (that solves the question on whether a function is balanced or not). The idea behind the B-V algorithm is that someone can find a secret number (sequence of bits) using only one measurement, unlike the classical counter-part, that requires n measurements, where n is the number of bits of the secret number. The implementation of this algorithm, using the Python programming language, along with the Qiskit framework (an open-source library for quantum operations from IBM), illustrates how to create and simulate a circuit for such an algorithm. The circuit is dynamically generated for the required number (which in practice is received from a different source) and is used to measure the probability of each qubit. The algorithm can also be extended for different types of data and can be used for signal or image processing, as well as applications in cryptography.

DOI
10.2478/bipie-2021-0009

Related papers

Implementation of the Bernstein–Vazirani Quantum Algorithm on the IBM Q Computers

Sydney Wang, Athena Zheng

The complexity of certain classical computer algorithms can be reduced by a quantum algorithm completing the same task. We examine the implementation of the Bernstein–Vazirani algorithm. It finds the hidden n-bit string s from the function fs(x)=sx that takes an n-bit input string x and outputs one bit, the dot product. This algorithm reduces the complexity from n queries for the best classical algorithm to just one. Though the quantum algorithm theoretically always gives the correct string, in practice, factors such as decoherence of the physical qubits due to external noise reduce the algorithm’s accuracy. By implementing the algorithm on the IBM 5-qubit and 14-qubit quantum computers, we are able to analyze correlations between the accuracy of the results and the properties of the physical qubits used. Not all qubits are pairwise connected, nor do they have the same coherence times. Using Python to build the quantum circuits, we create several implementations of the circuit with different qubits. We establish that 1/T1, 1/T2, and gate errors are positively correlated with calculation errors. Consequently, we observe that the 14-qubit quantum computer, on average, is more prone to errors than the 5-qubit quantum computer.

•Jan 1, 2019•0 citations

Seminal Quantum Algorithms Description and Programming

Ahcène Bounceur, Mohammad Ali A. Hammoudeh, Bamidele Adebisi +1 more

This chapter expounds on quantum algorithms, outlining fundamental concepts and their practical implementations. It starts with an explanation of core quantum principles such as functions and oracles. Then, it introduces Qiskit, an IBM-developed open-source quantum computing software framework. The discussion integrates theoretical underpinnings with empirical demonstrations, providing readers with an understanding of quantum programming intricacies. Through the utilisation of practical examples implemented in Qiskit, readers are given firsthand exposure, thereby reinforcing their comprehension of the subject matter. The overarching objective is to equip readers with a comprehensive knowledge base, thereby fostering proficiency in navigating the theoretical underpinnings and practical applications of quantum computing. To this end, the chapter ends with an examination of three seminal quantum algorithms: Deutsch, Deutsch-Jozsa, and Bernstein-Vazirani. These algorithms serve as keystones in the quantum computing domain, illustrating the efficacy and adaptability of quantum computation in resolving diverse computational problems.

CRC Press eBooks•Dec 9, 2024•0 citations

Practical Experience with IBM Q Quantum Computer: Bernstein–Vazirani Algorithm

Mikhail Pavlov

Abstract This study presents practical experience implementing the Bernstein–Vazirani algorithm on the IBM Q quantum computing platform, focusing on energy-efficient and reversible computation guided by Landauer’s principle. The work highlights the role of fundamental quantum logic gates—including CNOT, NOT, CCNOT, OR, and XOR—in constructing scalable, reversible circuits. By applying these principles, the Bernstein–Vazirani algorithm demonstrates an efficient solution to the problem of determining a hidden binary vector with a minimal number of queries, showcasing the potential for quantum computational speedup and optimization of information processing. The research emphasizes the importance of reversible quantum operations in improving computational efficiency and expanding the capabilities of modern quantum systems.

•Mar 4, 2026•0 citations

Quantum Query Algorithms

Walid E. Gomaa

This presentation gives a comprehensive overview of quantum query algorithms, beginning with an introduction to the query model of computation where input is accessed via an oracle function. It then details several foundational quantum algorithms that demonstrate a quantum advantage over classical approaches: Deutsch's problem is solved with a single query using phase kickback to determine if a function is constant or balanced; the Deutsch-Jozsa algorithm extends this to n-bit inputs, efficiently distinguishing constant from balanced functions with one query versus an exponential need classically; the Bernstein-Vazirani algorithm identifies a hidden string with one query, outperforming classical linear requirements; and Simon's algorithm, which finds a hidden period in a two-to-one function with a linear number of queries, showcases an exponential speedup over the best classical probabilistic algorithms.

•Nov 19, 2025•0 citations

A quantum algorithm for counting zero-crossings

Shukla, Alok

We present a zero-crossings counting problem that is a generalization of the Bernstein-Vazirani problem. The goal of this problem is to count the number of zero-crossings (or sign changes) in a special type of sequence S, whose definition depends upon a secret string. A quantum algorithm is presented to solve this problem. The proposed quantum algorithm requires only one oracle query to solve the problem, whereas a classical algorithm would need at least n oracle queries, where $2^n$ is the size of the sequence S. In addition to solving the zero-crossings counting problem, we also give a quantum circuit for performing the Walsh-Hadamard transforms in sequency ordering. The Walsh-Hadamard transform in sequency ordering is used in a wide range of scientific and engineering applications, including in digital signal and image processing. Therefore, the proposed quantum circuit for computing the Walsh-Hadamard transforms in sequency ordering may be helpful in quantum computing algorithms for applications for which the computation of the Walsh-Hadamard transform in sequency ordering is required.

arXiv:2212.11814•Dec 21, 2022•0 citations

A Generalization of Bernstein-Vazirani Algorithm to Qudit Systems

R Narayanan Krishna, Vishesh Makwana, Ananda Padhmanabhan Suresh

A quantum algorithm to solve the parity problem is better than its most efficient classical counter- part with a separation that is polynomial in the number of queries. This was shown by E. Bernstein and U. Vazirani and was one of the earliest indications that the quantum information processing can outperform the classical one by a significant margin. The problem and its solution both is usually stated for a 2-level system since we generally work with bits/qubits. However, many works have been done generalizing known quantum computing techniques to higher level systems. Following this, we look at a generalization of the Bernstein-Vazirani algorithm implemented on a general qudit system.

arXiv:1609.03185•Sep 11, 2016•5 citations
Abstract This paper describes the basics of quantum computing and then focuses on the implementation of the Bernstein-Vazirani algorithm, which can be seen as an extension of the Deutsch-Josza problem (that solves the question on whether a function is balanced or not). The idea behind the B-V algorithm is that someone can find a secret number (sequence of bits) using only one measurement, unlike the classical counter-part, that requires n measurements, where n is the number of bits of the secret number. The implementation of this algorithm, using the Python programming language, along with the Qiskit framework (an open-source library for quantum operations from IBM), illustrates how to create and simulate a circuit for such an algorithm. The circuit is dynamically generated for the required number (which in practice is received from a different source) and is used to measure the probability of each qubit. The algorithm can also be extended for different types of data and can be used for signal or image processing, as well as applications in cryptography.
The complexity of certain classical computer algorithms can be reduced by a quantum algorithm completing the same task. We examine the implementation of the Bernstein–Vazirani algorithm. It finds the hidden n-bit string s from the function fs(x)=sx that takes an n-bit input string x and outputs one bit, the dot product. This algorithm reduces the complexity from n queries for the best classical algorithm to just one. Though the quantum algorithm theoretically always gives the correct string, in practice, factors such as decoherence of the physical qubits due to external noise reduce the algorithm’s accuracy. By implementing the algorithm on the IBM 5-qubit and 14-qubit quantum computers, we are able to analyze correlations between the accuracy of the results and the properties of the physical qubits used. Not all qubits are pairwise connected, nor do they have the same coherence times. Using Python to build the quantum circuits, we create several implementations of the circuit with different qubits. We establish that 1/T1, 1/T2, and gate errors are positively correlated with calculation errors. Consequently, we observe that the 14-qubit quantum computer, on average, is more prone to errors than the 5-qubit quantum computer.
This chapter expounds on quantum algorithms, outlining fundamental concepts and their practical implementations. It starts with an explanation of core quantum principles such as functions and oracles. Then, it introduces Qiskit, an IBM-developed open-source quantum computing software framework. The discussion integrates theoretical underpinnings with empirical demonstrations, providing readers with an understanding of quantum programming intricacies. Through the utilisation of practical examples implemented in Qiskit, readers are given firsthand exposure, thereby reinforcing their comprehension of the subject matter. The overarching objective is to equip readers with a comprehensive knowledge base, thereby fostering proficiency in navigating the theoretical underpinnings and practical applications of quantum computing. To this end, the chapter ends with an examination of three seminal quantum algorithms: Deutsch, Deutsch-Jozsa, and Bernstein-Vazirani. These algorithms serve as keystones in the quantum computing domain, illustrating the efficacy and adaptability of quantum computation in resolving diverse computational problems.
Abstract This study presents practical experience implementing the Bernstein–Vazirani algorithm on the IBM Q quantum computing platform, focusing on energy-efficient and reversible computation guided by Landauer’s principle. The work highlights the role of fundamental quantum logic gates—including CNOT, NOT, CCNOT, OR, and XOR—in constructing scalable, reversible circuits. By applying these principles, the Bernstein–Vazirani algorithm demonstrates an efficient solution to the problem of determining a hidden binary vector with a minimal number of queries, showcasing the potential for quantum computational speedup and optimization of information processing. The research emphasizes the importance of reversible quantum operations in improving computational efficiency and expanding the capabilities of modern quantum systems.
This presentation gives a comprehensive overview of quantum query algorithms, beginning with an introduction to the query model of computation where input is accessed via an oracle function. It then details several foundational quantum algorithms that demonstrate a quantum advantage over classical approaches: Deutsch's problem is solved with a single query using phase kickback to determine if a function is constant or balanced; the Deutsch-Jozsa algorithm extends this to n-bit inputs, efficiently distinguishing constant from balanced functions with one query versus an exponential need classically; the Bernstein-Vazirani algorithm identifies a hidden string with one query, outperforming classical linear requirements; and Simon's algorithm, which finds a hidden period in a two-to-one function with a linear number of queries, showcases an exponential speedup over the best classical probabilistic algorithms.
We present a zero-crossings counting problem that is a generalization of the Bernstein-Vazirani problem. The goal of this problem is to count the number of zero-crossings (or sign changes) in a special type of sequence S, whose definition depends upon a secret string. A quantum algorithm is presented to solve this problem. The proposed quantum algorithm requires only one oracle query to solve the problem, whereas a classical algorithm would need at least n oracle queries, where 2n2^n2n is the size of the sequence S. In addition to solving the zero-crossings counting problem, we also give a quantum circuit for performing the Walsh-Hadamard transforms in sequency ordering. The Walsh-Hadamard transform in sequency ordering is used in a wide range of scientific and engineering applications, including in digital signal and image processing. Therefore, the proposed quantum circuit for computing the Walsh-Hadamard transforms in sequency ordering may be helpful in quantum computing algorithms for applications for which the computation of the Walsh-Hadamard transform in sequency ordering is required.
A quantum algorithm to solve the parity problem is better than its most efficient classical counter- part with a separation that is polynomial in the number of queries. This was shown by E. Bernstein and U. Vazirani and was one of the earliest indications that the quantum information processing can outperform the classical one by a significant margin. The problem and its solution both is usually stated for a 2-level system since we generally work with bits/qubits. However, many works have been done generalizing known quantum computing techniques to higher level systems. Following this, we look at a generalization of the Bernstein-Vazirani algorithm implemented on a general qudit system.