Grover Search Algorithm
Understand the importance of Grover’s algorithm and how it finds the key element efficiently.
The first algorithm we will tackle is the Grover search algorithm, which is a quantum algorithm that speeds up searching through databases. Lov Grover developed the algorithm in 1996. Although there are now many improved variations on the original algorithm, we’ll take a close look at how the original works because it uses a strategy that many other quantum algorithms use.
First, let’s think about a classical search question. Suppose we have cards, only one of which has a special purple dot on it. If we spread the cards out face down on a table, how many cards do we need to turn over to find the one with the purple dot? Well, we might be lucky and find it on the first try. More likely, we will have to turn over many cards before finding the one with the purple dot. In the worst case, we might turn over cards without seeing the purple dot. If that happens, we know that the dot must be on the remaining card, but we still turn it over to make sure that no one has messed with the cards. It turns out that on average, we need to flip just more than half of the cards to find the purple dot. The average is for cards, for cards, and for cards.
For the quantum version, we search for a particular quantum state. For a system with qubits, we have, as we know, possible states. Suppose we want to find just one state, equivalent to the card with the purple dot. To set up the search mechanism, we label the states with the binary number ranging from through .
We also need to “tag” the “target” state so the search mechanism has something to look for. Let’s assume that there is a function defined such that unless , where is the target state and someone has arranged for . Another way of putting this is that we give each of the basis states the amplitude . So, all the amplitudes have same magnitude. All will be positive except for the amplitude of the target state , which is negative. That amplitude is the quantum equivalent of the purple dot in our card example.
Get hands-on with 1400+ tech skills courses.