DeepAI

# Quantum divide and conquer

The divide-and-conquer framework, used extensively in classical algorithm design, recursively breaks a problem of size n into smaller subproblems (say, a copies of size n/b each), along with some auxiliary work of cost C^aux(n), to give a recurrence relation C(n) ≤ a C(n/b) + C^aux(n) for the classical complexity C(n). We describe a quantum divide-and-conquer framework that, in certain cases, yields an analogous recurrence relation C_Q(n) ≤√(a) C_Q(n/b) + O(C^aux_Q(n)) that characterizes the quantum query complexity. We apply this framework to obtain near-optimal quantum query complexities for various string problems, such as (i) recognizing regular languages; (ii) decision versions of String Rotation and String Suffix; and natural parameterized versions of (iii) Longest Increasing Subsequence and (iv) Longest Common Subsequence.

• 22 publications
• 15 publications
• 1 publication
• 7 publications
• 6 publications
10/17/2022

### A Note on Quantum Divide and Conquer for Minimal String Rotation

Lexicographically minimal string rotation is a fundamental problem on st...
10/19/2021

### Near-Optimal Quantum Algorithms for String Problems

We study quantum algorithms for several fundamental string problems, inc...
12/17/2020

### Quantum Algorithm for Lexicographically Minimal String Rotation

Lexicographically minimal string rotation (LMSR) is a problem to find th...
12/11/2018

### A Quantum Query Complexity Trichotomy for Regular Languages

We present a trichotomy theorem for the quantum query complexity of regu...
10/23/2020

### Quantum Meets Fine-grained Complexity: Sublinear Time Quantum Algorithms for String Problems

Longest common substring (LCS), longest palindrome substring (LPS), and ...
07/17/2019

### Almost tight bound on the query complexity of generalized Simon's problem

Simon's problem played an important role in the history of quantum algor...
01/15/2001

### Multiple-Size Divide-and-Conquer Recurrences

This short note reports a master theorem on tight asymptotic solutions t...

## 1 Introduction

Classically, divide and conquer is a basic algorithmic framework that applies widely to many problems (see, e.g., [Hoa62, KO63, CT65, Str69, CW90, CLRS09, AW21]). This technique solves a problem by recursively solving smaller instances of the same problem together with some auxiliary problem. In this paper, we develop a quantum analog of this framework that can provide quantum query complexity speedups relative to classical computation.

To motivate this investigation, consider a simple application of classical divide and conquer. Consider the problem of computing the function on bits. The classical deterministic query complexity of this problem is well known to be , since an algorithm must read all bits in the worst case to check if any of the bits equals . This upper bound is trivial since any query problem on bits can be solved by querying all bits, but to illustrate the quantum idea, we first consider re-deriving this classical upper bound using divide and conquer.

It is easy to see that for an -bit string , if and only if either or , where and are the left and right halves of . Thus we have divided the original problem into two smaller instances of the same problem, and given solutions to the two smaller instances, no further queries need to be made to solve the larger instance. Letting denote the classical query complexity of this problem, this argument yields the recurrence relation

 C(n)≤2C(n/2), (1)

which, noting , solves to , as desired.

Now notice that the last step that combines the solutions of the smaller instances to solve the larger instance is also an function, but on bits, since . We know that the quantum query complexity of the function on bits is due to Grover’s algorithm [Gro96], so we might be tempted to say that the of 2 bits should be faster to compute, potentially even quadratically faster. Thus we might like to write the following recurrence relation for the quantum query complexity of computing the function:

 Q(n)≤√2''Q(n/2). (2)

Here the quotes around the “” convey that this is not really justified. First, the complexity of Grover’s algorithm is not exactly , but only up to a constant factor. Even if it were exactly , Grover’s algorithm is a bounded-error algorithm, so if used as a subroutine that calls itself many times, the error will become unbounded very quickly. And of course, it does not make sense to imagine that the query complexity is a non-integer.

Even though we have just argued that Equation 2 is questionable, if we solve this recurrence anyway, we find .666This may be familiar to readers who know the quantum adversary method. However, our divide-and-conquer framework generalizes this phenomenon to a scenario that cannot be captured using adversary machinery alone, as discussed below. Up to a multiplicative constant, this is the correct answer for the quantum query complexity of the function on bits!

This is not a coincidence. As we show in this paper, this can be seen as a simple instance of a quantum algorithmic framework that we call “quantum divide and conquer.” More generally, a classical divide-and-conquer algorithm typically yields a recurrence relation of the form

 C(n)≤aC(n/b)+Caux(n), (3)

where is the classical query complexity of the auxiliary problem.

The main conceptual takeaway of our paper is that, in many settings, the quantum query complexity equals (up to a multiplicative constant) the solution, , of the analogous recurrence relation,

 CQ(n)≤√aCQ(n/b)+CauxQ(n), (4)

where the quantum query complexity of the auxiliary problem is . We show that this framework easily recovers and improves non-trivial quantum speedups that were previously known. Furthermore, we show it yields previously unknown quantum speedups that do not seem to be achievable by standard applications of techniques such as Grover search [Gro96]

, amplitude amplification and estimation

[BHMT02], and quantum walk search [Amb07].

### 1.1 Results

We apply quantum divide and conquer to the following decision problems, which we have ordered in roughly increasing difficulty. In all of these problems, we are given query access to a string over some set , i.e., query access to a function , with .

##### Recognizing regular languages.

We recover the key algorithmic result in [AGS19] that is used to upper bound the quantum query complexity of recognizing star-free languages. (The latter result is, in turn, the key result used by [AGS19] to establish a quantum query complexity trichotomy for recognizing regular languages.) In particular, we show that quantum queries suffice to decide whether a string contains a substring of the form , i.e., two s on either side of an arbitrarily long string of s. Having established our framework, the analysis is simpler than that of [AGS19].

##### String Rotation and String Suffix.

Let and . In String Rotation, the problem is to decide whether the lexicographically minimal rotation of starts at . In String Suffix, the problem is to decide whether the lexicographically minimal suffix of starts at . These problems are natural decision versions of problems studied in [AJ22]. We obtain an upper bound on the quantum query complexity for these problems, improving the previous best bound of , which follows from the algorithms of [AJ22] for the search versions. Furthermore, the analysis is again simpler using our framework.

##### k-Increasing Subsequence (k-Is).

Given a string over some ordered set and an integer , the -IS problem asks us to decide whether has an increasing subsequence777Recall that a subsequence of a string is obtained by taking a subset of the elements without changing their order. Note that this is more general than a substring, in which the chosen elements must be consecutive. of length at least . We obtain a bound of for any constant . The -IS problem is a natural parameterized version of Longest Increasing Subsequence (LIS), which is well-studied classically (see, e.g., [Fre75, AD99, SS10, RSSS19]). We consider this version because the quantum query complexity of LIS is easily seen to be888This follows by reduction from a threshold function such as majority [BBC01]. Given a string , define such that for all . Then we can determine the Hamming weight of by classically querying and adding to the length of the LIS of . , so we cannot hope for a quantum speedup without a bound on . Somewhat surprisingly, any constant bound on allows for a quadratic speedup over classical algorithms.

##### k-Common Subsequence (k-Cs).

Given two strings over some set and integer , the -CS problem asks us to decide whether and share a common subsequence of length at least . We obtain a bound of for any constant . The -CS problem is a natural parametrized version of Longest Common Subsequence (LCS), which is well-studied classically (see, e.g., [WF74, LMS98, CLRS09, AKO10, ABW15, RSSS19]). Again, we consider this version because the quantum query complexity of LCS is easily seen to be999This also follows by reduction from a threshold function such as majority. Given a string , define . Then we can determine the Hamming weight of as the length of the longest common subsequence of and . .

Note that LCS is closely connected to Edit Distance (ED), which asks us to compute the number of insertions, deletions, and substitutions required to convert into . In fact, if substitutions were disallowed, the edit distance between and would equal (a proof can be found in, e.g., [AVW21, Lemma 6]).

All of our quantum query complexity upper bounds are tight up to logarithmic factors and represent quantum-over-classical speedups since the classical (randomized) query complexities of all problems considered are .

### 1.2 Techniques

To derive the quantum recurrence relation in Equation 4, we employ the quantum adversary method as an upper bound on quantum query complexity [Rei11, LMR11]. The adversary quantity is a real number that can be associated with any query problem of size . For convenience, we write when is clear from context. It is well-known that is upper and lower bounded by the (two-sided bounded error) quantum query complexity, , of up to multiplicative constants.

If a problem can be expressed as the composition of smaller problems, then the adversary quantity of the larger problem can be expressed in terms of those of the smaller problems [Rei11, LMR11]. For example, suppose is the of copies of together with another problem , corresponding to the auxiliary work performed in a divide-and-conquer algorithm. Then the composition theorem implies

(For a more precise statement, see Section 2.) Taking square roots101010Note that while taking square roots gives a closer analogy with the classical recurrence, in some cases we can get a slightly tighter bound by instead directly solving the recurrence for . and using the fact that is bounded by , where , we obtain precisely Equation 4, i.e.,

We then bound by constructing an explicit quantum algorithm for the auxiliary work and bounding its quantum query complexity. Finally, we solve Equation 6 either directly or by appealing to the Master Theorem [BHS80] to obtain a bound on and hence a bound on . Note that this bound is insensitive (up to a multiplicative constant) to the constant implicit in , whereas it is highly sensitive to the constant in front of .

We emphasize that the recurrence in Equation 6 involves both the adversary quantity and the quantum query complexity. At a high level, this is why the bound on resulting from solving Equation 6 does not follow directly from adversary techniques alone nor from quantum algorithmic techniques alone. Indeed, when we solve Equation 6 as a recurrence relation, we mix adversary and algorithmic techniques at each step of the recursion. In principle, it is possible to use Equation 6 to construct an explicit quantum algorithm for because there is a constructive, complexity-preserving, and two-way correspondence between span programs—whose complexity is characterized by the adversary quantity—and quantum algorithms [Rei09b, CJOP20, Jef22]. However, this correspondence is involved.

This quantum divide-and-conquer framework allows us to use classical divide-and-conquer thinking to come up with a classical recurrence relation that we can easily convert to a corresponding quantum recurrence relation in the form of Equation 6. Bounding then reduces to bounding , which can be easier than the original problem. In our applications to -IS and -CS, we bound by using quantum algorithms for the versions of these problems, whose query complexities we can bound inductively. Note that the base cases () of these problems are trivial, being equivalent to search and (bipartite) element distinctness, respectively.

The form of Equation 6 depends on the way we divide and conquer. Strikingly, in our application to -CS, we find that an optimal (up to logarithmic factors) quantum query complexity can be derived by breaking the problem into seven parts (so that ) but not fewer. Classically, the number of parts we break the problem into makes no difference as any choice leads to an classical query complexity.

In the discussion above, we have assumed that the function relates to and . However, this is only to simplify our exposition. In fact, we can use quantum divide and conquer for any function relating to and . Functions that we use to obtain quantum speedups include combinations of and . In our application of quantum divide and conquer to -CS, the function is a combination of and . While alone yields no quantum speedup, our analysis relies on an adversary composition theorem that we prove, which allows us to preserve the speedup yielded by . We remark that there are many other functions that could yield quantum speedups, but which we have not yet considered in applications. Examples include (which decides if the subproblems all return the same answer or not) and (which decides if exactly of subproblems return )—see [RŠ12, Table 1]—and their combinations with , , and . We leave the consideration of such functions for future work.

### 1.3 Related work

The technique of using adversary composition theorems (and their relatives) to establish upper bounds on quantum query complexity has been applied in several previous works, beginning with the setting of formula evaluation [Rei09a, RŠ12]. In [Kim13], an adversary composition theorem is used to bound the quantum query complexity of a function given a bound on that of composed with itself times. More generally, the adversary quantity has been used to upper bound the quantum query complexity of problems including -distinctness [Bel12a], triangle finding [Bel12b, LMS17], undirected -connectivity [BR12], and learning symmetric juntas [Bel14]. In contrast to our work, these prior results typically bound the adversary quantity using only tools from the adversary world, such as span programs, semidefinite programming, and composition theorems, without constructing quantum algorithms to use as subroutines.

The first two application areas of quantum divide and conquer that we consider (recognizing regular languages and String Rotation and String Suffix) arise in [AGS19, AJ22] as discussed above. Turning to -IS and -CS, we first note that, despite the importance of these problems, there have been no significant works on their quantum complexities. Directly using Grover search [Gro96] over all possible positions of a -witness gives trivial bounds as soon as . Directly using quantum walk search [Amb07] also yields highly sub-optimal bounds of for -IS and for -CS.

Classically, LIS and LCS are typically solved using dynamic programming. There are many recent works on quantum speedups for dynamic programming, e.g., [ABI19, Abb19, GKMV21, ABI20, KPV22]. The main idea of these works is to classically query a part of the input and to repeatedly use the result together with a quantum algorithm to solve many overlapping subproblems. However, we found it difficult to apply this idea to -IS and -CS.

Given the generality of the results in [AGS19] and the fact that we can recover some of its results, one might ask if the converse holds, i.e., if [AGS19] can recover our results on -IS and -CS. Indeed, the results of [AGS19] do apply111111For example, -IS can be expressed in first-order logic as where indicates that the th element is . Expressibility in first-order logic is equivalent to being in a star-free language, which can be recognized with quantum query complexity by [AGS19]. to -IS and -CS when the set size is constant. However, under that assumption, these problems can be easily solved by Grover search [Gro96] and quantum minimum finding [DH96] using queries. Moreover, -CS becomes qualitatively easier when is constant as its complexity drops to , down from the bound that we establish when is unbounded. Note that is not in the trichotomy of [AGS19], i.e., not one of , , or .

##### Organization.

This paper is organized as follows. We first introduce background material and describe how to use the quantum divide-and-conquer framework for certain scenarios in Section 2. Then we apply the framework to four string problems in Section 3, obtaining near-optimal quantum query complexities for each. In particular, we consider recognizing regular languages in Section 3.1, String Rotation and String Suffix in Section 3.2, -Increasing Subsequence in Section 3.3, and -Common Subsequence in Section 3.4. Finally, we conclude by presenting some open problems in Section 4.

## 2 Framework

In this section we introduce some notation and explain how to apply the quantum divide-and-conquer framework in specific scenarios.

Let denote the positive integers. We reserve for positive integers and for a finite set. For , we write . For any two matrices and of the same size, denotes their entrywise product, also known as their Hadamard product. For any matrix , let denote the element in the th row and th column. For a function , let its Gram matrix be defined as for all , where is the Kronecker delta function. For a length- string , we write for the th element of and for the substring of that ranges from its th to th elements (inclusive). We write and . When is equipped with a total order, and and , we write inequalities between and (e.g., ) to refer to inequalities with respect to the lexicographic order.

We write for (the quantum query complexity of

with failure probability at most

).

A closely related quantity that is also used widely, and serves as both a lower and upper bound for the quantum query complexity of function computation, is the adversary quantity, .

Let , , and be finite sets and with . Let be a function with Gram matrix and with . Then the adversary quantity for is

where the maximization is over real, symmetric matrices satisfying .

The following result connecting and will be useful.

###### Theorem 1 ([Hlš07, Lmr+11]).

Let be a function. Then .

The adversary quantity for a composite function can be expressed in terms of the adversary quantities of its components. In this work, we specifically consider cases where (i) ; (ii) ; or (iii) a scenario on functions and defined as for , .

[Adversary composition for and ]LemmalemAdversaryAndOr Let and let be a finite set. Let and . Let be such that and . Then .

creftypecap 1 follows from [LMRŠ10, Rei11]. For completeness, we provide a proof in Section A.1. Note that the lemma still holds if and share variables.121212For example, if with , then .

[Adversary composition for ]LemmalemAdversarySwitch Let and let be finite sets. Let . For , let . Define by . Then

See Section A.1 for a proof of creftypecap 1.

A divide-and-conquer strategy for a problem of size typically involves dividing the problem into subproblems on smaller instances of size for and combining the solutions by solving another auxiliary problem . The classical cost for is denoted . The classical cost of solving is then described by the recurrence

 C(n)≤aC(n/b)+Caux(n). (8)

The situation is more subtle in the quantum case. Equation 8 bounds the cost of solving the size- problem by summing the costs of solving each subproblem and the auxiliary problem. However, our quantum recurrence relations come from adversary composition theorems, which impose restrictions on how the size- problem decomposes into subproblems and an auxiliary problem.

We consider decision problems that correspond to the computation of a Boolean function , where is a finite set, and we have oracle access to an input . While the most general form of quantum divide and conquer can compute by breaking it into sub-functions and an auxiliary function (corresponding to the subproblems and an auxiliary problem) in many different ways, here we focus on two strategies.

1. [label=Strategy 0.,ref=0,leftmargin=*]

2. is computed as an formula involving an auxiliary function and sub-functions , where .

3. is computed sequentially as follows: (1) Compute an auxiliary function , where is a finite set, to obtain some ; (2) indicates a set of sub-functions , where , and a Boolean function , such that is computed as the function defined by

 g(s)∘(f(s)1,…,f(s)a)(x(1),…,x(a))\coloneqqg(s)(f(s)1(x(1)),…,f(s)a(x(a))). (9)

Using the adversary composition theorems stated previously, the next corollary shows how to obtain quantum recurrence relations for when is computed according to Item 1 or Item 2.

###### Corollary 1 (Quantum divide-and-conquer strategies).

Let , , , , and be as defined in Items 2 and 1. Then

###### Proof.

For Item 1, and are all Boolean functions and is computed as an formula of these functions. Therefore, we can directly apply creftypecap 1 to obtain

For Item 2, is first computed to give an . Then, is computed as . Therefore, can be expressed using as

 (13)

Therefore, we can directly apply creftypecap 1 to obtain

The corollary follows. ∎

While adversary composition theorems play a key role in decomposing the adversary quantity for , one novel aspect of our framework lies in the switching from the adversary quantity to the quantum query complexity when handling the auxiliary function. This switching means our framework employs both the adversary and quantum algorithms toolboxes.

We recall a few well-known quantum query complexity bounds that are used in subsequent sections, usually to bound the quantum query complexity of the auxiliary function .

###### Theorem 2 (Quantum query complexity bounds).

Let with and consider functions and for finite sets .

• [itemsep=0pt]

• Unstructured search. For the function with , finding an such that has quantum query complexity [Gro96].

• Minimum finding. Given an unsorted list , the quantum query complexity of finding the minimum (or maximum) element in the list is [DH96].

• String matching. Given two strings with , determining if is a substring of has quantum query complexity [RV03].

• String comparison. Given two strings for an ordered set , determining whether has quantum query complexity . This is because the problem reduces to minimum finding.

• Bipartite element distinctness. Given two strings such that , and , finding and such that has quantum query complexity [Amb07].

Finally, once we have the quantum recurrence relation for a problem along with a bound on the quantum query complexity of , we use the Master Theorem to solve the recurrence to bound , and thereby . This is just like in classical divide and conquer.

We state the Master Theorem below for convenience.

###### Theorem 3 (Master Theorem [Bhs80]).

Let , , and . Suppose satisfies the recurrence

 A(n)=aA(n/b)+O(nclogpn). (16)

Then

 A(n)=⎧⎪⎨⎪⎩O(nlogba)if logba>c,O(nlogbalogp+1n)if logba=c,O(nclogpn)if logba

## 3 Applications

In this section we apply the divide-and-conquer strategies described previously to various string problems. Note that we divide a problem on strings of length into subproblems on strings of length for . Without loss of generality, we assume that for some so that for all .131313When , we can divide into subproblems of sizes or without affecting the validity of our arguments.

### 3.1 Recognizing regular languages

We first consider the problem of recognizing regular languages to demonstrate how quantum divide and conquer allows one to prove [AGS19, Theorem 18], without needing the intricacies of the original proof. In the following, we prove a special case of this result, mentioned in the abstract of [AGS19], that captures its essence. We do not prove [AGS19, Theorem 18] in its full generality only because that would require introducing significant terminology related to regular languages but would not offer further insight. Let .

###### Problem (Recognizing Σ∗20∗2Σ∗).

Given query access to a string , decide if , i.e., if contains a substring with two s on either side of an arbitrarily long string of s.

###### Theorem 4.

The quantum query complexity of Recognizing is .

###### Proof.

We upper bound the quantum query complexity of the function defined by iff .

Clearly, contains the expression if and only if the expression is contained (i) entirely in the left half of the string; or (ii) entirely in the right half of the string; or (iii) it is partly contained in the left half and partly in the right half of the string. Therefore, we have

 fn(x)=fn/2(xleft)∨fn/2(xright)∨gn(x), (18)

where is defined by

 gn(x)={1if x[i..j] is of the form 20∗2 for some i≤n/2

Clearly, can be decided by the following algorithm using queries:

Grover search for the maximal index such that and the minimal index such that . If either fails to exist, output .

Decide whether equals by Grover search. Output if yes and if no.

Therefore, writing , observing that Equation 18 follows Item 1 and using Corollary 1 gives , which solves to by the Master Theorem (creftype 3). Hence, by creftypecap 1. ∎

### 3.2 String Rotation and String Suffix

Let be equipped with a total order in this subsection. We consider the following problems.

###### Problems (String Rotation and String Suffix).

Let and . Given query access to a string , we define the following problems.

1. Minimal String Rotation. Decide if for all .

2. Minimal Suffix. Decide if for all .

###### Remark.

These problems are decision versions of the problems studied in [AJ22], which gives algorithms that output the positions of the minimal string rotation and minimal suffix.

As observed in [AJ22], both problems reduce to the following problem.

###### Problem (Minimal Length-l Substring).

Let with . Given query access to strings and , decide if all length- substrings of are lexicographically at least .

We prove the following lemma by quantum divide and conquer.

###### Lemma 1.

The quantum query complexity of Minimal Length- Substring with is .

###### Proof.

We upper bound the quantum query complexity of the function defined by iff all length- substrings of are lexicographically at least .

Observe that if and only if (a) all length- substrings contained in are lexicographically at least ; and (b) all length- substrings that start with are lexicographically at least . Also observe that all length- substrings contained in are either contained in or contained in . Therefore, we deduce that

 fn(x,y) =(fn/2(x[1..\sfracn2],y[1..\sfracn4])∧fn/2(x[\sfracn4+1..\sfrac3n4],y[1..\sfracn4]))∧gn(x,y), (20)

where is defined by

 gn(x,y) (21)

We can show that by considering an algorithm described as follows.

Use the quantum string matching algorithm (see creftypecap 2) to find the first and last positions where starts in . Call these two positions and , respectively. This takes queries. Similarly, use the quantum string matching algorithm to find the first and last positions where starts in . Call these two positions and , respectively. This takes another queries.

Use the quantum string comparison algorithm (see creftypecap 2) to decide whether all the length- substrings in starting at one of the positions in is lexicographically at least . If yes, then output ; otherwise, output . This takes queries. Clearly, uses queries. The correctness of follows from [AJ22, Lemma 4.8].141414Set , , and in [AJ22, Lemma 4.8]. We also remark that [AJ22, Lemma 4.8] is stated with “…let denote the set of answers in the Minimal Length- Substrings problem on the input string .” By examining the proof, it can be seen that the lemma still holds with the quoted sentence replaced by “…let denote a fixed length- substring, let denote the set of starting points of in the input string .” This is because [AJ22, Lemma 2.3] can still be applied in the latter case.

Now, setting , observing that , and using Corollary 1 for Item 1 gives , which solves to by the Master Theorem (creftypecap 3). Hence, by creftypecap 1. ∎

###### Remark.

The analysis in [AJ22, Theorem 4.1] for Minimal Length- Substring would yield a looser bound of for its quantum query complexity. That analysis is more involved because it splits the problem into a non-constant number of parts, . This is because quantum algorithms are recursively applied to obtain a recurrence of the form , which, due to the coefficient in front of the , requires to be non-constant to solve to . In general, it can be difficult to split a problem into a non-constant number of parts by only relying on quantum algorithmic techniques (e.g., consider an formula), so such an approach may not yield optimal upper bounds (even up to an factor). We note that our analysis above is a quantum analogue of the classical divide-and-conquer analysis in [AJ22, Start of Section 4.2].

creftypecap 5 below follows from Lemma 1 and the chain of reductions described in [AJ22, Propositions 4.2–4.5 and Theorem 4.6]. We sketch a proof for completeness.

###### Theorem 5.

The quantum query complexities of Minimal String Rotation and Minimal Suffix are .

###### Proof sketch.

Let be defined as in the proof of Lemma 1. The theorem follows from two observations:

1. Minimal String Rotation can be computed by .

2. Minimal Suffix can be computed by , where is defined to be smaller than all elements in and is defined to be larger than all elements in .∎

###### Remark.

The quantum query complexities of Maximal String Rotation and Maximal Suffix (defined in the obvious way) are also because they easily reduce to Minimal String Rotation and Minimal Suffix.

### 3.3 k-Increasing Subsequence

Let be equipped with a total order and fix to be a constant in this subsection. We consider the following problem, which is a natural parametrized version of Longest Increasing Subsequence.

###### Problem (k-Is).

Let . Given query access to , decide if has a -IS, i.e., if there exist integers such that .

To solve -IS, we solve a variant of it that we call -Increasing Subsequence* (-IS*), defined as follows. We consider -IS* because it is more susceptible to recursion.

###### Problem (k-Is*).

Let and let denote an element outside . Given query access to , decide if has a -IS*, i.e., if there exist integers such that and for all .

We now prove the main theorem of this subsection.

###### Theorem 6.

The quantum query complexities of -IS and -IS* are both .

###### Proof.

Clearly, -IS reduces to -IS* without using additional queries. Therefore, it suffices to prove the theorem for -IS*. We upper bound the quantum query complexity of the function defined by iff contains a -IS*.

We first introduce some definitions. Define . Define by if and only if contains an -IS* consisting of an -IS*, , and a -IS*, , such that . For , define by , where the minimization is over those that are the last index of some -IS* in . Similarly, define by , where the maximization is over those that are the first index of some -IS* in .

Observe that the increasing subsequence can be (i) contained entirely in the left half of ; or (ii) contained entirely in the right half of ; or (iii) partially contained in both halves with elements in the left and elements in the right for some . Therefore, we have

 LISk,n(x)=LISk,n/2(xleft)∨LISk,n/2(xright)∨k−1⋁i=1LIS(i,k−i),n(x). (22)

Therefore, by Corollary 1 for Item 1, we obtain the quantum divide and conquer recurrence

 ak(n)2≤2ak(n/2)2+k−1∑i=1O(Q(LIS(i,k−i),n)2). (23)

Now,

 Q(LIS(i,k−i),n)≤Q(min-lasti,n/2)+Q(max-firstk−i,n/2), (24)

because can be computed by computing and and checking that .

Moreover, for any , and can be computed by a “randomized search” that uses computations of and Grover search, which is similar to the approach taken for quantum minimum finding [DH96]—see Section A.2 for a proof. Therefore, for all , we can use creftype 1 to obtain

 Q(min-lastj,n),Q(max-firstj,n)≤O((aj(n)+√n)log(n)). (25)

Substituting the combination of Equation 24 and Equation 25 into Equation 23 shows that, for , we have

 ak(n)2≤2ak(n/2)2+O(ak−1(n)2log2(n)), (26)

where we used the fact that is constant and for all , which follows by applying creftypecap 1 to the observations that (i) for all , where is some element smaller than all elements in , and (ii) computing is equivalent to searching for a .

Finally, we prove by induction on . The base case () follows by applying creftypecap 1 to the observation that computing is equivalent to searching for a . For