Introducing search algorithms
In Chapter 8, Quantum Algorithms I – Deutsch-Jozsa and Bernstein-Vazirani, you saw and implemented function checking algorithms that helped you to identify whether a particular function is constant or balanced. Now, in this chapter, we will be building upon the foundations of function checking and will implement the famous quantum searching algorithm known as Grover's search algorithm.
Before we begin our discussion on quantum search algorithms, let's first understand the search algorithms classically available to us. The two most prominent search algorithms are linear search and binary search, which are used widely to search for an element in a database or array. In linear search, each element of the array is traversed and is compared with the marked element that we are trying to search. Since each element is being compared, if the desired element is present at the very end of the array, then it will take N searches to find the desired...