Computation
Quantum
Algorithms
Some problems that would take ordinary computers millions of years to solve could be cracked by a large quantum computer in days. This page explores the key algorithms that make that possible — what they do, how they work, and why it matters right now.
What Makes a Quantum Algorithm?
Quantum Advantage and Where It Comes From
A classical computer works through possibilities one at a time — or in parallel batches, but still checking each candidate. A quantum computer can hold all possible answers in play simultaneously and then use the physics of waves to make wrong answers cancel out and correct answers reinforce each other. The result is that some problems can be solved with far fewer steps. (Formally: by exploiting superposition, entanglement, and interference — wrong-answer amplitudes interfere destructively, correct-answer amplitudes interfere constructively.)
This does not mean quantum computers are faster at everything. The advantage only appears for problems with a specific mathematical structure that quantum mechanics can exploit. For most everyday computing tasks, a classical machine is just as good — or better. (The complexity class BQP — Bounded-error Quantum Polynomial time — captures exactly which problems a quantum computer can solve efficiently. It is widely believed BQP does not contain all of NP, so quantum computers are not a general solution to hard combinatorial problems like the travelling salesman problem.)
Grover's Search Algorithm
Grover's Search Algorithm
Unstructured Database Search
Problem: You have a large pile of unsorted items and need to find one specific item. There is no index, no shortcut — just raw search.
Classical approach: On average you have to look through half the pile before finding it. Double the pile size, double the work. (Cost: O(N) — linear in the number of items.)
Quantum approach: Grover's algorithm finds the item in roughly the square root of the number of steps a classical search would need. A database of one million items requires about 1,000 quantum steps instead of 500,000 classical ones. This speedup is mathematically proven to be the best any quantum algorithm can do for this type of problem. (Cost: O(√N) — quadratic speedup, provably optimal for unstructured search.)
How it works: The algorithm starts by putting all possible answers into play at once. It then repeatedly runs two operations — one that marks the correct answer by flipping its sign (the oracle Uf: |x⟩ → −|x⟩), and one that boosts the marked answer's probability at the expense of all others (the diffusion operator, inversion about the mean). After roughly (π/4)√N repetitions, measuring the system returns the correct answer with high probability.
Why it matters: Grover's algorithm weakens the kind of encryption that uses one shared secret key (such as AES). On paper it cuts the effective strength of a key in half — a 128-bit key behaves like a 64-bit key. In practice the attack is far harder than that sounds: Grover's steps must run one after another and don't split efficiently across many machines, so standards bodies still treat 128-bit keys as acceptable and recommend 256-bit keys where data must stay secret for decades. (Grover gives a quadratic speedup on brute-force key search, 2ⁿ → 2^(n/2), but parallelising across M machines only gains √M; NIST's post-quantum guidance keeps AES-128, -192 and -256 approved.) Grover's idea, amplitude amplification, also appears as a building block inside many other quantum algorithms.
Grover's Algorithm in Five Steps
Shor's Factoring Algorithm
Integer Factorisation
Problem: Given a large number, find the two prime numbers that multiply together to produce it. This sounds simple, but it is the mathematical foundation of most internet encryption — and classical computers cannot do it at scale.
Classical approach: For the key sizes used in real encryption (such as RSA-2048, a roughly 600-digit number), the best classical algorithms would take longer than the age of the universe to factor. This intractability is what makes RSA secure today. (Best known classical algorithm: the General Number Field Sieve, running in sub-exponential time — exp(O((log N)^⅓ (log log N)^⅔)).)
Quantum approach: Shor's algorithm factors the same numbers in polynomial time — meaning the work grows manageably with the size of the number, not astronomically. (Cost: O((log N)³) gates. A variant by Regev — published in the Journal of the ACM in 2025 — reduces the gate count per run to about O(n^(3/2) log n) at the cost of more runs and qubits; Pilatte proved it works unconditionally, published in 2026.)
How it works: Rather than trying factors directly, Shor's algorithm transforms the factoring problem into finding a repeating pattern — specifically, the period of a mathematical function built from the number being factored. Finding that period on a classical computer is just as hard as factoring itself, but a quantum computer can extract it efficiently using the Quantum Fourier Transform, which detects periodicities in quantum superposition the same way a prism splits light into its component frequencies. Once the period is known, the prime factors follow from standard arithmetic. (The QFT extracts the period r of f(x) = aˣ mod N; the factors then follow via GCD computations using Euclid's algorithm.)
Cryptographic significance: A working large-scale quantum computer running Shor's algorithm would break RSA, Diffie-Hellman, and elliptic curve cryptography — the protocols securing virtually all internet traffic, banking, and private communications today. No machine that can do this exists yet, but the estimated size of one has shrunk fast. In 2019 the best estimate was about 20 million physical qubits; by 2025 it was under 1 million. Two 2026 proposals cut it again — to under 100,000 qubits using more efficient error-correcting codes, and to as few as about 10,000 atom-based qubits, though a machine that small would need months to factor a single RSA-2048 key. (Gidney & Ekerå 2019 → Gidney 2025, ~1,400 logical qubits, <1 week; Webster et al. "Pinnacle", Feb 2026, qLDPC codes, ~1 month; Cain et al., Mar 2026, reconfigurable neutral atoms. The 2026 papers are preprints and all assume hardware not yet built, with ~0.1% physical error rates.) Elliptic curve keys are shorter, so they are likely to fall before RSA. In response, NIST finalized the first three post-quantum cryptography standards in August 2024 — FIPS 203 (ML-KEM), FIPS 204 (ML-DSA), and FIPS 205 (SLH-DSA) — with more following, and is urging organizations to migrate now.
The Quantum Fourier Transform
Quantum vs Classical Complexity