This is an animation of Grover's Quantum Search Algorithm. It finds x for which f(x)=1, assuming that f equals 0 for all other values.
In this example, we assume that x ranges from 0 to 7 and hence we need a 3 bit search space. Our "secret" function f happens to satisfy f(x)=1 for x=2. The algorithm requires 3 qubits for the search space plus one extra "worker" qubit to make it possible to perform the required phase flips. Here, the left 3 qubits make up the search space, and the right most bit is the worker qubit.
The initial state consists of "0001" followed by the application of the Hadamard operator applied to of all the qubits. This is what you should see displayed below before pressing "Run". Given that f(x)=1 for the binary value "010", the algorithm should significantly increase the magnitude of the amplitudes of "0100" and "0101". It then just needs to measure the left 3 qubits and it has a high probability of finding the required answer of "010".
The algorithm in this example is able to complete in 2 iterations where each iteration consists of two steps:
Quantum State: ...
You may also be interested in the Quantum Computer Gate Playground.
Copyright (c) 2013-2014 David Kemp