Algorithms

Grover's Algorithm: Unstructured Database Search

Explore the quantum search algorithm that provides a quadratic speedup over classical searches.

QWiki Team 1 min read
#algorithms#search#grovers#speedup
Explore Labs

Introduction

Grover's algorithm, designed by Lov Grover in 1996, is a quantum algorithm that solves the problem of searching an unstructured database or solving an inverted function with NN entries in O(N)\mathcal{O}(\sqrt{N}) steps.

The Speedup

  • Classical: Searching an unsorted database of size NN requires checking entries one by one, resulting in a linear time complexity of O(N)\mathcal{O}(N) on average.
  • Quantum: Grover's algorithm solves this in O(N)\mathcal{O}(\sqrt{N}) evaluations, representing a quadratic speedup.

Core Steps

Grover's algorithm does not look at all entries at once, but rather amplifies the probability amplitude of the correct state through iterative geometry:

  1. State Initialization: Prepare an equal superposition of all database indices.
  2. Grover Iteration (repeated ≈π4N\approx \frac{\pi}{4}\sqrt{N} times):
    • Oracle: Flips the phase of the target state (∣w⟩→−∣w⟩|w\rangle \to -|w\rangle).
    • Diffusion Operator (Inversion about the mean): Reflects all amplitudes about the average amplitude, amplifying the target and dampening the others.
  3. Measurement: Measures the register, yielding the target index with near-100% probability.