Quantum Computing / Algorithms
Quantum algorithm guides
Understand each available circuit, review its configuration and explore it in Composer. These guides follow the current algorithm gallery.
Oracle algorithms
Deutsch's algorithm →A black-box function takes one bit and returns one bit. Is it constant or balanced?
1 input qubit + 1 ancillaDeutsch–Jozsa →A hidden function takes n bits and returns one bit. Is it constant or balanced?
n = 1..6 input qubits + 1 ancillaBernstein–Vazirani →A hidden function returns s · x mod 2 for a secret n-bit string s. Find s.
n = 1..6 input qubits + 1 ancillaBernstein–Vazirani: CCNOT + phase correction →One secret like standard BV, but this CCNOT oracle needs phase correction. Unlike two-secret BV, it returns the same string every run.
n = 1..5 input qubits + 2 ancillasProbabilistic Bernstein–Vazirani →Two secret strings share one oracle. A run returns one complete string; repeat to discover both.
n = 2..5 input qubits + 2 ancillasSimon's algorithm →A hidden 2-to-1 function has f(x) = f(x ⊕ s) for a secret s ≠ 0ⁿ. Find s.
n = 2..4 input + n output qubitsGrover search →Amplify any set of marked basis states to near-certainty in O(√(N/M)) oracle calls.
n = 2..7 qubits (uses MCX)Deterministic Grover search →Use a prepared ancilla to make Grover's integer search rounds land exactly on a marked state in an ideal circuit.
n = 2..5 search qubits + 1 ancillaFixed-point Grover search →Find marked states with a guaranteed high success rate even when their exact fraction is unknown.
n = 2..4 search qubitsQuantum counting →Estimate how many states an oracle marks using phase estimation on Grover's iterate.
2–4 search + 2–4 counting qubitsAmplitude estimation →Estimate the chance of a marked outcome after a configurable state preparation.
2–4 search + 2–4 counting qubitsHidden shift (bent function) →Recover the exact bit shift s between a known bent function and its shifted oracle.
2, 4, or 6 qubits · no ancillaTransforms
Quantum Fourier Transform →Map computational basis states to the frequency domain — the core of QPE and Shor.
n = 1..6 qubitsDraper QFT adder →Add a into b with Fourier-basis phase rotations. The n-bit result wraps modulo 2^n without a carry wire.
2–6 qubits (two 1–3-qubit registers)Quantum Phase Estimation →Estimate the eigenphase φ of a unitary U to t bits of precision.
t = 1..6 counting qubits + 1 eigenstate qubitArithmetic
QFT half adder →Add two binary registers and keep the overflow as a separate carry-out bit.
3–7 qubits (n = 1..3)QFT full adder →Add two binary registers and a carry-in bit; read the sum and carry-out separately.
4–6 qubits (n = 1..2)Half adder →Add two input bits: sum A ⊕ B and carry AB. Compare the PDF's clean-output and in-place circuits.
3 or 4 qubits · one-bit inputsFull adder →Add A, B and carry-in as single bits. Three CX gates make the sum; three CCX gates make carry-out.
5 qubits · three one-bit inputsCuccaro ripple-carry adder →Add two binary registers with a CX/CCX carry ladder, keeping the final carry-out.
4–8 qubits (n = 1..3)Quantum comparator →Set a flag when unsigned a is less than b, while preserving both input registers.
4–8 qubits (n = 1..3)Modular adder mod 15 (Beauregard) →Add a chosen classical value to a four-bit quantum register, wrapping at 15 rather than 16.
6 qubits · 4-bit resultQRAM fan-out toy →Route one address to either of two one-bit cells and read the selected bit coherently.
5 qubits · 2 cellsProtocols
Remote state preparation →Prepare a known polar or equatorial state on Bob's qubit using one shared Bell pair and one classical bit.
2 qubits; 1 classical bitQuantum secret sharing (HBB) →Alice shares a random key bit with Bob, Charlie and Diana. All three recipients must cooperate to reconstruct it.
4 qubits; dealer + 3 recipientsQuantum Teleportation →Transmit a qubit's state using a shared Bell pair and two classical bits.
3 qubits, 2 classical bitsGate teleportation →Teleport a T gate instead of a state. The trick that makes T gates affordable under error correction.
3 qubits, 2 classical bitsEntanglement swapping →Entangle two qubits that never interacted, by measuring the two in the middle. The repeater primitive.
4 qubits, 4 classical bitsE91 (Ekert) key exchange →Generate candidate keys from singlet pairs and test measured correlations with a Bell inequality; compare an intercept-resend attack.
2 qubits per pairBB84 key exchange →Prepare, measure in a random basis, sift, and watch an eavesdropper show up in the error rate.
1 signal qubit per transmissionSuperdense Coding →Send two classical bits by transmitting a single entangled qubit.
2 qubits, 2 classical bitsFoundations & paradoxes
Quantum Zeno effect →Frequent measurements inhibit a rotation. Compare a watched qubit with an unmeasured reference under the same drive.
2 qubitsElitzur–Vaidman bomb tester →Detect a live bomb without explosion in a fraction of attempts. A two-qubit model of interaction-free measurement.
2 qubits, 2 classical bitsGames & pseudo-telepathy
Meyer's quantum penny flip →A one-qubit coin game: Q's coherent strategy guarantees heads against a classical flip or pass.
1 qubitMermin–Peres magic square →Two players share two Bell pairs and win every ideal round. Classical strategies win at most 8/9 across uniform row/column questions.
4 qubitsGHZ game →Three separated players use local measurements to win every ideal round. Classical strategies win at most 75% across uniform questions.
3 qubitsPrimitives & tests
Rényi-2 entropy →Interfere two independently prepared copies to estimate subsystem purity and entanglement entropy from one ancilla.
5 qubits; 1 measured ancillaSWAP test / Hadamard test →Use one measured ancilla to compare two states, or probe the real or imaginary expectation of a unitary.
2–3 qubits · 1 measured ancillaGHZ / W states + CHSH test →Prepare three-qubit GHZ or W entanglement, or test a Bell inequality with four independently prepared Bell pairs.
3 qubits (GHZ/W) or 8 qubits (CHSH)Quantum walks
Quantum walk on a cycle →Walk a ring of N = 2^n nodes with a Hadamard coin and watch it spread ballistically.
1 coin qubit + n = 2..5 position qubitsQuantum walk on a 2D torus →Walk a periodic grid with a four-sided Grover coin — two coin qubits, one position register.
2 coin qubits + nx + ny position qubitsQuantum walk on a hypercube →Walk the d-dimensional hypercube from one corner and watch the amplitude gather on the opposite one.
log2(d) coin qubits + d position qubits — 3, 6 or 11 in totalHypercube walk search →Find a marked vertex with the Shenvi–Kempe–Whaley coin — no ancilla, no controlled Hadamard.
log2(d) coin + d position qubits — 6 at d = 4, 11 at d = 8Quantum Error Correction
Three-Qubit Error Correction →Explore what a repetition code can—and cannot—correct for X, Z, Y, or seeded random errors.
3 data + 2 syndrome ancillasQEC: Steane Seven-Qubit Code →Correct any one-qubit X, Z, or Y error with the [[7,1,3]] CSS code and six stabilizer checks.
7 data + 1 recycled syndrome ancillaQEC: Bacon-Shor 3x3 Repeated Cycles →Run bounded, repeated syndrome extraction with a recycled ancilla and compare physical correction with Pauli-frame recovery.
9 data + 1 recycled syndrome ancillaShor's 9-qubit code →Correct an arbitrary single-qubit error using nine physical qubits and stabilizer measurements.
10 qubits, 8 classical bits