Time Complexity of the Oracle Phase in Grover’s Algorithm

Since Grover’s algorithm was first introduced, it has become a category of quantum algorithms that can be applied to many problems through the exploitation of quantum parallelism. The original application was the unstructured search problems with the time complexity of O( N ). In Grover’s al-gorithm, the key is Oracle and Amplitude Amplification. In this paper, our purpose is to show through examples that, in general, the time complexity of the Oracle Phase is O(N), not O(1). As a result, the time complexity of Grover’s algorithm is O(N), not O( N ). As a secondary purpose, we also attempt to restore the time complexity of Grover’s algorithm to its original form, O( N ), by introducing an O(1) parallel algorithm for unstructured search without repeated items, which will work for most cases. In the worst-case scenarios where the number of repeated items is O(N), the time complexity of the Oracle Phase is still O(N) even after additional preprocessing.


Introduction
Quantum Computing [1] [2] [3] [4] [5] is a field of computing that leverages the principles of Quantum Mechanics.Traditional computers use bits as the fundamental unit of information, which can exist in one of two states: 0 or 1.Quantum computers, on the other hand, use qubits, which can exist in multiple states simultaneously.Quantum Computing has strange phenomena known as Superposition and Entanglement.search problems, i.e. from T = O(N) to T = O( N ).It was proposed by Lov Grover [6] in 1996 and is a fundamental algorithm in the field of Quantum Computing.Its efficiency arises from the exploitation of quantum parallelism and quantum interference.Furthermore, it has evolved into a category of algorithms that can be applied to many problems, such as SAT [7], and Subset Sum [8].
Grover's algorithm [6] is: Initialization; Oracle; for ( i = 0; i < O( N ), i++) Amplitude Amplification; Measurement; where: Initialization: Start with a superposition of all possible states.If there are N = 2 n possible solutions, where n is the number of qubits, this superposition is created over N states.
Oracle: Introduce an Oracle gate that identifies the target solution.
Amplitude Amplification: Apply a series of quantum operations that amplify the amplitude of the marked state and suppress the amplitudes of the other states.
Repeat Amplification: Amplifications are repeated for a certain number of iterations.
Measurement: The quantum state is measured, and with high probability, the correct solution is obtained.
We will divide Grover's algorithm into two phases: Oracle Phase and Amplitude Amplification Phase, where the Oracle Phase consists of Initialization and Oracle.The job of the Oracle is to mark the solution.Amplitude Amplification is the constructive and destructive interference that occurs during the Amplitude Amplification step.The amplitudes of incorrect states experience destructive interference, reducing their probabilities, while the amplitude of the correct state experiences constructive interference, increasing its probability.
To date, no one has challenged the main conclusion of Grover's algorithm: T = O( N ) for both Amplitude Amplification and the entire algorithm.Inexpli- citly, the algorithm assumes that Oracle Phase, Initialization and Oracle, has T = O (1).In Grover's algorithm, the starting superposition of all possible states is given in Equation (5), which is indeed O (1).In this paper, we will show that T = O(1) for the Oracle Phase only applies to scenarios where: • the target number can be found in the unstructured data, and • there are no repeated items in the unstructured data.
We will show that if any one of the above conditions is violated, then, T = O(N) for the Oracle Phase.Furthermore, if both of the above conditions are satisfied, the algorithm's behavior is predictable, i.e. there is no need for the algorithm at all.When the target is not in the list, the target must be rejected by the Oracle Phase so the algorithm will not enter into the next phase.However, if the list does not contain the target item, the oracle operation will not find any valid solution to mark and stop the algorithm.This step requires all of the items in the unsorted list to be encoded into the initial superposition state, which is O(N).
When the list has repeated items, the normalization of the initial superposition state must be reconstructed if it is required to find all of the matching items.
All of the items in the unsorted list need to be encoded into the initial superposition state, which is also O(N).
This paper will make a high-level logical discussion rather than whether a particular task is possible or not at the quantum circuit level.For example, we will simply assume that we can produce an initial superposition state based on a given list with respect to each item in the list.
Clearly, if the time complexity of the Oracle Phase is O(N), then Grover's algorithm is also O(N).Even if we have shown that the Oracle has T = O(N), we will need to at least attempt to show that this is not trivial, i.e. there are no trivial solutions to restore the time complexity of Oracle Phase to O(1).We can restore the time complexity of Grover's algorithm to O( N ) by introducing an O(1) parallel SIMD algorithm for unstructured search without repeated items, which will work for most cases.In the worst-case scenarios where the number of repeated items is O(N), the time complexity of the Oracle Phase is still O(N).The SIMD architecture is not readily available, especially when a search list is large, so this is only a solution in theory.
This paper is organized as follows: Section '2.Basic Notation and Background' first introduces X = {0,1} d space.
Then, we will introduce the notation for superposition vectors.
Section '3.T = O(1) for the Oracle Phase' describes the situation where the initialization is fixed and is independent of a particular unsorted list to be searched.
Section '4.Two Problems for the Oracle Phase' describes the necessity of encoding the initial superposition states from the unsorted list.
Section '5.An O(1) Parallel Algorithm for Unstructured Search without Repeated Items' attempts to restore the time complexity of Grover's algorithm to O( N ) with a SIMD algorithm.This algorithm works for most cases.Because it is not really practical to build a SIMD architecture for a large amount of processing units, this is a solution in theory.
Section '6.A Parallel Algorithm for Unstructured Search with Repeated Items' shows that in the worst-case scenarios, the time complexity of the Oracle Phase is still O(N).

Basic Notation and Background
Throughout this paper, n is the number of qubits; N = 2 n is the number of states; L <= N is the number of items in an unsorted list; M is the unsorted list.
The unstructured search problems have: Grover's algorithm [6] provides a quadratic speedup over the best classical algorithms for unstructured search problems, i.e. from T = O(N) to T = O( N ).
Today, Grover's algorithm is also a category of algorithms that can be applied to many problems [7] [8].
The advantage of the unstructured search problem is that the Oracle is easy to construct, i.e. the Oracle merely marks the target number, which is given.For example, let n = 3, and we want to search a target, 5 101 = , from an arbitrary random list, M = {3, 4, 6, 0, 1, 2, 7, 5}.Since we know |101⟩ is the solution, the Oracle simply marks the 101 state.

T = O(1) for the Oracle Phase
Grover's algorithm starts with the initialization, which starts with a superposition of all possible states.If there are N = 2 n possible solutions, where n is the number of qubits, this superposition is created over N states given in Equation (5).Already, we have noticed that the Initialization is search-list independent.
The only requirements are that the random list: can be encoded into n qubits in theory.
The Oracle identifies the target; since the target in the random-list search problem is given, the Oracle's job is simply to mark it.One thing is immediately obvious.Assuming that we want to find 5 from two arbitrary search lists, say, {3, 4, 6, 0, 1, 2, 7, 5} and {3, 4, 6, 0, 7, 5, 1, 2}, the initial superposition states will be the same in both cases, because the initial superposition state is Equation ( 5).
In fact, Grover's algorithm, based on the initial superposition state alone, can always find a target from {0, 1, 2, … , N − 1}.Any search problem will result in exactly the same answer: Found.Furthermore, the behavior of the algorithm is fixed and predictable; therefore, there is no need to even run through Grover's algorithm at all, because we already know the answer: Found.
In other words, the very existence of Grover's algorithm is not necessary, because we know the outcome of the algorithm ahead of time: there is only one answer: Found.This, of course, is exactly the problem, as we can see from the examples below.
Answer: found 5, because algorithm has only one answer.
Answer: found 6, because algorithm has only one answer.
Answer: found 7, because algorithm has only one answer.
You can see the problem in Example 3; the target is not in the list and the answer is wrong.

Two Problems for the Oracle Phase
The Amplitude Amplification Phase cannot reject a state.When the target is not in the list, the target must be rejected by the Oracle Phase.The Oracle is designed to mark the target solution in the quantum state.The Oracle would flip the sign of the amplitude of the state representing the target.However, if the list does not contain the target item, the Oracle will not find any valid solution to mark and stop the algorithm.Equation (5), which contains all of the possible items in the unsorted list, is no longer valid now.All of the items in the list, and only all of the items in the list, can be encoded into the initial superposition state.Given an unsorted list, the initial superposition state should be: ( ) This initialization is problem-dependent.Equation ( 11) is built from Equation ( 10) by looping each item in Equation (10).The time complexity for the loop is O(N) rather than O(1).This is the cost of correcting Example 3.
Example 3. Finding 7 from {3, 3, 0, 0, 4, 2, 0, 0}.The initial superposition state below has O(N) steps by going through each item in the unsorted list: ( ) The Oracle is designed to mark the target solution in the quantum states.In this example, however, the list does not contain the target item, 7 111 = .The Oracle would stop the algorithm.The cost for the Oracle is O(N) instead of O (1).
Also, repeated items will introduce an extra factor because the superposition state is normalized; for example, in the above example, because item, 0, appears four times, it has an extra normalization factor: 1 000 4 The extra factor depends on the number of times an item is repeated, which can be found by looping through the list, which again is O(N).To summarize, there are problems: • The search target is not in the random list; • There are repeated items in the random search list.
If Equation (11) has O(N), Grover's algorithm has lost all of its advantages, at least for the unstructured search problem.Even if we have shown that the Oracle has T = O(N), we will need to at least attempt to show that there are no trivial solutions to restore the time complexity of Oracle to O(1).In the following, we attempt to restore the time complexity of Grover's algorithm to O( N ) with a SIMD algorithm.This algorithm works for most cases.Because it is not really practical to build a SIMD architecture for a large number of processing units, this is a solution in theory.

An O(1) Parallel Algorithm for Unstructured Search without Repeated Items
In this section, we will introduce an O(1) parallel algorithm for unstructured search without repeated items.SIMD [9] [10] [11] [12] [13] stands for Single Instruction, Multiple Data.It is a parallel computing architecture that performs the same operation on multiple data points simultaneously.In SIMD, a single instruction is executed across multiple processing elements, each operating on a different set of data.
We assume the number of processing elements is the same as the number of items in the random list.We further assume that the processing elements are fully connected.
Message passing is a communication paradigm used in parallel computing to enable communication and coordination between different processing units, such as processing elements.In message passing, processes communicate by sending and receiving messages through a communication network or interconnect.Each processing element has its own address, but can exchange data and synchronize with other processes using messages.
Send and Receive Operations [9] [10] [11] [12] [13] are defined as processes that can send messages to each other using "Send" operations and receive messages using "Receive" operations.A process initiates a send operation to transmit a message to another processing element, specifying the destination processing element and the data to be sent.The destination process then initiates a receive operation to receive the message.The pseudo codes for Send and Receive are: Send (destination-address, message), Receive ().Each processing element is labeled by its address: i.e. processing element, P 0 or P[0], has an address of 0, … .We will assign a variable (or array), m, to each processing element, for receiving messages with the following initialization: And a SIMD array in Equation (12), one can simply match each item in the unsorted list to its corresponding processing element, i.e. match m 0 with P 0 , m 1 with P 1 , … .By assumption, each processing element will send and receive once.The element, P[i] = P i , i= 0, 1, 2, 3, …, will send a message: