The state starts as an equal real superposition over all N basis states, aᵢ = 1/√N — a genuine amplitude array, updated with real vector arithmetic every step. Each Grover iteration applies two real operators to that array in sequence:
oracle: aᵢ → −aᵢ for every marked i
diffusion: aᵢ → 2·mean(a) − aᵢ for every i
The diffusion step is an exact inversion about the mean amplitude — it is computed from the array's own running average each iteration, not looked up from a formula. Together the two steps rotate the amplitude vector inside the 2-D plane spanned by the marked and unmarked subspaces by a fixed angle θ = arcsin(√(M/N)) per iteration, so probability of measuring a marked state is P(k) = sin²((2k+1)θ) — it climbs toward 1 near k* = π/4·√(N/M), then keeps rotating past it and falls back down. Auto-run does not stop at k* on purpose: watch the bars overshoot and the curve turn over, the classic "more iterations is not always better" behaviour of Grover's algorithm.
- N basis states — the size of the unstructured "database" being searched; classical search needs ~N/2 queries on average, Grover needs only ~π/4·√N.
- Marked targets M — click bars to mark more than one state; more targets means a shorter optimal iteration count (θ grows with √(M/N)) and a sharper overshoot.
- Race classical search — probes basis states one at a time in random order (real linear scan, no shortcuts) so you can compare its query count against the quantum iteration count directly.
Real-world relevance: this quadratic O(√N) vs O(N) speedup is why Grover's algorithm is a textbook building block for quantum-accelerated search and optimisation subroutines, even though — unlike Shor's algorithm — it offers a polynomial rather than exponential advantage.