Abstract
Algorithms that search for a pattern within a larger dataset appear ubiquitously in text and image processing. Here, we present an explicit, circuitlevel implementation of a quantum patternmatching algorithm that matches a search string (pattern) of length M inside a longer text of length N. Our algorithm has a time complexity of \(\tilde{O}(\sqrt{N})\), while the space complexity remains modest at O(Nā+āM). We report the quantum gate counts relevant for both prefaulttolerant and faulttolerant regimes.
Introduction
Pattern matching is one of the core algorithms in computer science that stand to benefit from quantum computers^{1,2}. Pattern matching algorithms are used ubiquitously used in image processing^{3,4}, the study of DNA sequences^{5}, and data compression and statistics^{6}, to name a few. Thus, accelerating pattern matching using a quantum computer would be a boon to all these areas.
The simplest form of pattern matching is string matching. In string matching, given a long string \({\mathcal{T}}\) of length N, we search for a pattern \({\mathcal{P}}\) of length M with Māā¤āN^{7}. Depending on the application, we may need to search for an exact match or a fuzzy match, or a match with some wildcards^{8}.
The best known classical algorithm for string matching is the KnuthPrattMorris algorithm, which has the worstcase time complexity of Ī(Nā+āM)^{9,10}. The bestknown algorithms for approximate string matching have a similar runtime of Ī(Nā+āM). For random strings, the exact matching complexity is lower bounded by \({{\Omega }}((N/M)\mathrm{log}\,(M))\)^{11}.
Ramesh and Vinay developed an exact string matching quantum algorithm with a query complexity of \(\tilde{O}(\sqrt{N}+\sqrt{M})\)^{1}. This algorithm uses Groverās search to identify the position at which a segment of length M from \({\mathcal{T}}\) matches the pattern \({\mathcal{P}}\), where each of the checks is done using a nested Grover search. However, this work does not construct explicit oracles required and the total time complexity, measured in units of gate depth, is bound to increase once we account for the gatelevel complexity of accessing the text and pattern from a database. Another approach that relies on a quantum solver for the dihedral hidden subgroup problem^{12} has a time complexity of \(\tilde{O}({(N/M)}^{1/2}{2}^{O(\sqrt{{\mathrm{log}}\,(M)})})\) for averagecase matching^{13}. This work also assumes that M is larger than the logarithm of the length N, i.e \(M=\omega (\mathrm{log}\,N)\) and fails with a high probability for certain worstcase inputs. In our work, we do not make any assumptions on the length of pattern or the distribution of inputs.
In this paper, we present a stringmatching algorithm, based on generalized Groverās amplitude amplification^{14}, with a time complexity of \(\tilde{O}(\sqrt{N})\) for arbitrary text length N and pattern length Māā¤āN. Note our algorithm does not rely on a quantum database, incurring no initialization overhead of the database, expected to be O(N), that would overshadow any quantum advantage. The techniques we develop for our algorithm can readily be extended to solve pattern matching problems in higher dimensions. Over the course of detailing each step of our algorithm, we also ensure to provide a gateābyāgate level instruction to construct relevant quantum circuits. This allows us to straightforwardly obtain a concrete estimate of the total gate counts. The gate counts we report help us establish contexts as to when we may expect quantum computers to be of help in the problem space of pattern matching.
Our paper is organized as follows. To motivate the readers, we first compare our main results that are derived in the remainder of the paper with the current state of the art. After the comparison, we provide an outline of our stringmatching algorithm. In Section āResultsā, we provide the details of the algorithm, including the explicit circuits for all necessary oracles. We then calculate the overall complexity of our algorithm. We provide an estimate for gate counts in terms of CNOT and T gates, useful for prefault tolerant and fault tolerant regimes, respectively. We summarize our paper in Section āDiscussionā and discuss the implications of our results.
We start by pointing out that our work differs from^{13}, where the algorithm therein targets an average case input, in that we, as in^{1}, provide a quantum algorithm for pattern matching for the worst case inputs. The work in^{13} further assumes \(M=\omega (\mathrm{log}\,(N))\), whereas the work in^{1} and the work reported in this manuscript do not. We rely on a Grover oracle (see Section āGrover oracleā) that simply checks if a state is an allzero state in the computational basis, whereas the oracles in refs ^{1,13} are random memory access oracles of the form \({\sum }_{i}\lefti\right\rangle \left0\right\rangle \to {\sum }_{i}\lefti\right\rangle \left{t}_{i}\right\rangle\) where t_{i} is the ith bit of a text. As such, we are unaware of an efficient quantum circuit that implements the oracle (see Section G.4 of the appendix of ref. ^{15} for the bestknown construction) without resorting to quantum random access memory (QRAM)^{16}. The known blueprints for QRAM^{16} have polylogarithmic time complexity in the size of memory to be accessed. In our case, the size of memory is O(N) and, therefore, QRAM queries will incur at additional multiplicative cost of at least \(O({(\mathrm{log}\,N)}^{2})\). Moreover, we would also have to account for the cost of initializing the quantum memoryāthis is expected to take a number of operations linear in N^{17}. In contrast, our algorithm does not assume any random access oracles. We also provide an explicit circuit for the Grover oracle we need using elementary quantum gates, specifically singlequbit Clifford, T, and CNOT gates.
Note the algorithm in ref. ^{13} fails with a probability O(1/N) over the choice of \({\mathcal{T}}\) and \({\mathcal{P}}\). For certain worstcase \({\mathcal{T}}\) and \({\mathcal{P}}\), the algorithm inherently fails to return a match. In addition, there is internal randomness in the algorithm which contributes to an additional probability of failure. Our work also fails with probability O(1/N) if there is a match between \({\mathcal{T}}\) and \({\mathcal{P}}\), but this is purely due to the internal randomness of Groverās algorithm. We can simply repeat the algorithm to suppress the failure probability to be arbitrarily small, with the average repetition number of N/(Nāāā1). We make no assumptions on the distribution of text and pattern and the algorithm works for all possible inputs. This may be contrasted to the impossibility to suppress the failure probability by repeated use of the algorithm for the worstcase inputs in ref. ^{13}.
Our algorithm has a space complexity of O(Nā+āM) since we need N (M) qubits to store the text (pattern). With Nā>āM, we may omit the M dependence and simplify it to O(N). The space complexities of^{1,13} depend on the space complexity of the oracle. Assuming an Nbit register containing the text to be searched over is prepared in QRAM, in the bucketbrigade model, the bulk of the space complexity comes from routing qutrits, where random access over N bits of information requires O(N) routing qutrits. Expending a constant number of qubits for each qutrit, the space complexities of^{1,13} are Ī©(N), and likely Ī(N).
Finally, unlike the two prior works, the simplicity of our algorithm allows us to not just provide an explicit circuitlevel blueprint for the algorithm but also estimate the quantum resources needed to implement it. A summary of the comparison between our work and^{1,13} is given in Table 1.
In the remainder of this section, we outline the steps of our algorithm. The detailed implementation is presented in Section āResultsā.

1.
Initialize two quantum registers to
$$\left{t}_{0}{t}_{1}{t}_{2}\ldots {t}_{N1}\right\rangle \left{p}_{0}{p}_{1}\ldots {p}_{M1}\right\rangle ,$$where t_{i} and p_{i} denote the ith bit of string \({\mathcal{T}}\) and pattern \({\mathcal{P}}\), respectively.

2.
Transform the first register containing the string \({\mathcal{T}}\) into a superposition of N states, where each state is a bitshifted state of the original state of the first register, shifted by 0, 1, 2..., Nāāā1 bits. This results in, assuming moduloN space for the bit indices,
$$\left(\frac{1}{\sqrt{N}}\mathop{\sum }\limits_{k = 0}^{N1}\left{t}_{0+k}{t}_{1+k}{t}_{2+k}\ldots {t}_{N1+k}\right\rangle \right)\left{p}_{0}{p}_{1}\ldots {p}_{M1}\right\rangle$$(1) 
3.
Compute XOR between the first M bits of the first register and all M bits of the second register to obtain
$$\begin{array}{ll}&\frac{1}{\sqrt{N}}{\mathop{\sum}\limits_{k}}\left{t}_{0+k}{t}_{1+k}\ldots {t}_{N1+k}\right\rangle \\ &\left({p}_{0}\oplus {t}_{0+k})({p}_{1}\oplus {t}_{1+k})\ldots ({p}_{M1}\oplus {t}_{M1+k})\right\rangle .\end{array}$$(2) 
4.
The second register is all zeros if the pattern matches with the first M bits of \({\mathcal{T}}\). The register contains d ones if the string and the pattern differ in d bit positions.

5.
Use the generalized Grover search or amplitude amplification^{14} to isolate the state where the second register has all zeros (when searching for exact match) or has fewer than D matches (in the case of fuzzy search).
Results
In this section, we lay out the detailed implementation of the algorithm we outlined above. Specifically, we detail the transformations and registers used to implement the algorithm. One of the central transformations to be used in our algorithm is the cyclic shift operator. We present the details of its construction in Section āConstruction of the cyclicshift operator.ā We also present the construction of the necessary Grover oracle in Section āGrover oracleā for completeness.
To encode a binary string \({\mathcal{T}}\) of length N and a binary pattern \({\mathcal{P}}\) of length M, we use quantum registers of N and M qubits, respectively. This can be done by using identity and bitflip gates on a quantum register initialized as \({\left0\right\rangle }^{\otimes (N+M)}\). Denoting the encoded states as
where t_{i} (p_{i}) is the ith bit of string \({\mathcal{T}}\) (\({\mathcal{P}}\)), together with an index register of n qubits in the zero states, we prepare on a quantum computer a composite initial state
where, for convenience, we assumed Nā=ā2^{n}. Next, we apply an nqubit Hadamard transform H^{ān} (or a Fourier transform in case of Nāā ā2^{n} for \(n\in {\mathbb{N}}\)) on the index register to produce a uniform superposition of \(\left0\right\rangle ,\left1\right\rangle ,\ldots \leftN1\right\rangle\), i.e.,
We now apply a cyclic shift operator \({\mathcal{S}}\) that leftcircular shifts the qubits of the target state by k positions, where the values of k are encoded in the control state (see Section āConstruction of the cyclicshift operatorā for details). Applying \({\mathcal{S}}\) on the first two registers results in
At this point, we check for the match between the cyclicallyshifted text strings in the second register and the pattern string stored in the third register. We use an XOR operation between each of the first M bits of the second register with each of the M bits of the third register. For instance, if the XOR results are all zeros, the strings match. With the help of CNOT gates on a quantum computer then, we obtain, with an abuse of notation,
The final register, to this end, contains the number of mismatches between the pattern and the first M bits of the string register. Indeed, it is all zero if and only if those two string segments match completely.
We may now use the generalized Grover search or amplitude amplification^{14} to search for the state where the pattern register is in \(\left0\right\rangle\) state (in the case of exact search). If this state is found, we know that the pattern occurs in the string. We also obtain the position from the index register where this match occurs. In addition to the exact match, we can also use this method to search for fuzzy matches or matches with wildcards by constructing appropriate Grover oracles.
Construction of the cyclicshift operator
In this subsection, we explicitly construct a circuit that implements the cyclicshift operator \({\mathcal{S}}\). The tworegister operator \({\mathcal{S}}\) is defined according to
To implement the kcontrolled circular shift operator S_{k}, we consider k in its binary encoded form \(\leftk\right\rangle\) as \(\left{k}_{0}\right\rangle \left{k}_{1}\right\rangle \ldots \left{k}_{n1}\right\rangle\), such that 2^{0}k_{0}ā+ā2^{1}k_{1}ā+āā¦ā+ā2^{nā1}k_{nā1}ā=āk. The circular bitwise rotation by k in the second register can then be implemented by a product of controlledshift operators that shifts the target qubits by 2^{j} bits, conditioned on the k_{j}th qubit. Using \({{\mathcal{S}}}_{a}{{\mathcal{S}}}_{b}={{\mathcal{S}}}_{a+b}\), we may now write
where \({{\mathcal{S}}}_{{2}^{j}}^{({k}_{j})}\) applies a shift of 2^{j} bits on the second register, which encodes the text \({\mathcal{T}}\), controlled by the jth qubit of the index register \(\leftk\right\rangle\). The circuit decomposition of this as a visual guide is shown in Fig. 1.
The decomposition shown in (9) reveals that, together with (8), it suffices to now consider the controlled bitshift operators \({S}_{{2}^{j}}^{(c)}\) that circular shifts by 2^{j} bits for some j conditioned on qubit c to implement the cyclicshift operator \({\mathcal{S}}\). To this end, in order to construct the circuit for \({S}_{{2}^{j}}^{(c)}\), we first consider an operator \({S}_{{2}^{j}}\) without any controls, which, as we show below, can be implemented using SWAP gates. We later promote the swap gates to a controlled version, effectively replacing the SWAP gates with controlledSWAP (Fredkin) gates.
A circular shift operator S_{s} by s bits applies a permutation P_{s}, in modulo N space, of the form
where the Nāāāsth bit is inserted in the zeroth position, Nāāāsā+ā1th bit is inserted in the first position, and so on. Any such permutation can be decomposed into a product of transpositions. As a result, a circular shift operation of the form (9) can be decomposed into a product of SWAP operations.
We now calculate how many SWAPoperation layers are needed to efficiently apply the permutation of the form (10). With a register with N qubits, we can apply N/2 SWAP operations in parallel. Using the N/2parallel SWAP operator, we can move N/2 qubits to their right positions in a single time step. This leaves us with sorting the remainder of N/2 bits. At each subsequent time step, the number of qubits that need to be swapped decreases by half. Therefore, we can arbitrarily permute N qubits in \(O(\mathrm{log}\,(N))\) time steps using parallel SWAP operations. A sample diagrammatic representation of this unitary operation is shown in Fig. 2. This implies that each of the controlled shift operators \({S}_{{2}^{j}}^{{k}_{j}}\) in (9) can be achieved in \(O(\mathrm{log}\,(N))\) time steps using parallel controlledSWAP operators.
We next discuss a method to apply as many as N/2 parallel swap operations, controlled on the same qubit in the index register. As shown below, we achieve this at the cost of N/2 clean ancilla qubits.
We start by considering a fanout CNOT operation, acting on the control qubit in a state \(\left{k}_{j}\right\rangle\) and N/2 clean ancilla qubits initialized to \(\left0\right\rangle\) as targets. This results in N/2 copies of \(\left{k}_{j}\right\rangle\), which can then be used to implement up to N/2 Fredkin gates in a single time step. Once all necessary Fredkin gates have been implemented, we undo the fanout operation and return all ancilla qubits to \(\left0\right\rangle\) states. We recycle the freedup ancilla qubits for the subsequent control qubits, one at a time.
The time cost of the fanout operation is \(O(\mathrm{log}\,(N))\). Since there are \(O(\mathrm{log}\,(N))\) parallel SWAP layers required for the implementation of the qubit permutation discussed in Section āConstruction of the cyclicshift operatorā, the overall time complexity of \({S}_{{2}^{j}}^{(c)}\) is \(O(\mathrm{log}\,(N))\).
Grover oracle
To complete our algorithm, we need a Grover oracle U_{w} that acts on the pattern register, required to amplify and help identify exact matches or close matches. The oracle may be defined according to
where d is zero if we desire to find exact matches and a small number if we desire to find close matches. Assuming an architecture that has longrange interactions, we can obtain this oracle in \(O({\mathrm{log}}\,(M))\) depth using O(M) ancilla qubits. We note in passing that there have also been proposals to implement a singlestep ncontrol Toffoli that takes O(1) time in trappedion and neutralatom architectures^{18}. For the remainder of the paper, however, we take the circuitdepth complexity of this oracle to be \(O({\mathrm{log}}\,(M))\).
Time complexity
In this subsection, we compute the time complexity of our algorithm. Encoding of strings \({\mathcal{T}}\) and \({\mathcal{P}}\) takes O(1) time. The Hadamard transformation applied to the index register takes O(1) time as well. The cyclicshift operator \({\mathcal{S}}\) takes time \(O({({\mathrm{log}}\,(N))}^{2})\), since each \({S}_{{2}^{j}}^{({k}_{j})}\) operator, including the fanout and its uncompute operation, takes \(O({\mathrm{log}}\,(N))\) time and \(j=0,1,2,...,{\mathrm{log}}\,(N)1\). The evaluation of XOR results via CNOT gates takes time O(1), as it admits a straightforward parallel operation. Lastly, the Grover oracle has the complexity \(O(\mathrm{log}\,(M))\). The overall complexity of the steps considered so far, a single Grover step, is then \(O({({\mathrm{log}}\,(N))}^{2}+{\mathrm{log}}\,(M))\).
For the Grover search to be successful, we need to repeat the Grover steps \(O(\sqrt{N})\) times. This brings the total complexity to \(O(\sqrt{N}({({\mathrm{log}}\,(N))}^{2}+{\mathrm{log}}\,(M)))\).
Space complexity
In addition to the N and M qubits needed to encode the search string and the pattern, we need \(O(\mathrm{log}\,(N))\) qubits for the index register. For the depthoptimized implementation of our algorithm we need N/2 ancilla qubits for the index register. Furthermore, O(M) ancilla qubits are required for the depthoptimized Grover oracle implementation. Therefore, the space complexity of our stringmatching algorithm is O(Nā+āM).
Gate counts
In this section, we obtain an estimate for the gate count in terms of CNOT and T gates. We chose the two gates as metrics since it is widely expected that twoqubit gates, such as CNOT, are expected to dominate the cost of implementation in the prefault tolerant regime, whereas T gates are expected to dominate the cost of implementation in the faulttolerant regime, assuming the standard gate set of Cliffordā+āT.
The strings \({\mathcal{T}}\) and \({\mathcal{P}}\) can be encoded in qubits initially in \(\left0\right\rangle\) state using only identity and bitflip(X) gates and thus the encoding step has zero cost. A Hadamard transform of the index register in (5) needs \(\mathrm{log}\,(N)\) Hadamard gates, requiring zero cost as well. The cyclic shift operator \({\mathcal{S}}\) in (6) consists of \(\mathrm{log}\,(N)\) applications of \({S}_{s}^{(c)}\) operators. Each \({S}_{s}^{(c)}\) operator consists of a CNOT fanout to N/2āāā1 target qubits, its inverse, and at most Nāāā1 Fredkin gates, since the permutation specified in (10) of size as large as N can be decomposed into at most Nāāā1 transpositions. As shown explicitly in Supplementary Note 1, based on circuit identities reported in refs ^{19,20}, each Fredkin gate costs 7 CNOT gates and 7 T gates. Thus the cyclic shift operator costs at most \((8N9)\mathrm{log}\,(N)\) CNOT gates and \([7(N1)]\mathrm{log}\,(N)\) T gates. Next, the XOR operation in (7) takes M CNOT gates. Lastly, the Grover oracle of (11), using a parallelized version of the results reported in^{21} (see Supplementary Note 2 for details), can be implemented with 6Māāā12 CNOT gates and 8Māāā17 T gates with a linear overhead in ancilla upper bounded by Māāā3.
Finally, we need to repeat this \(\sqrt{N}\) times for amplitude amplification. The total CNOT and T count is, thus, given by
where the factor of 2 comes from the fact that for amplitude amplification, we need to apply a unitary to produce a state \(\left\psi \right\rangle =U\left0\right\rangle\) and also the inverse unitary U^{ā }.
Based on (12), we see that searching for a pattern with 20 ASCII characters (or 160 bits) in a text file that is 1 MB long would require about 10^{13} CNOT and T gates. Similarly, searching for a kilobytelong pattern of a genetic signature in a genome sequence of 1 GB would require more than 10^{17} CNOT and T gates. We expect classical computers to outperform quantum computers for datasets of such length. However, for applications like matching templates in data generated by gravitationalwave experiments which may be petabytes long (matching a megabytelong signature in the petabytelong text would require 10^{25} CNOT and T gates), we may expect to see the quantum advantage.
Discussion
In this paper, we have constructed a quantum stringmatching algorithm that admits a circuitdepth complexity of \(O(\sqrt{N}({(\mathrm{log}\,(N))}^{2}+\mathrm{log}\,(M)))\). We also provide an explicit gatelevel implementation of our algorithm, enabling a concrete estimate of quantum resources needed. The direct use cases of the matching algorithm range from a simple text search in a large file to detecting patterns in an image. The simple matching procedure can help, for example, in making intelligent recommendations based on pictures in a consumer device^{22}, detecting defects in industrial lithography^{23}, detecting signals in large timeseries data collected in experiments like the Laser Interferometer GravitationalWave Observatory^{24}, etc. In these applications, the typical size of data to be searched varies between ~10^{6} and ~10^{15} bytes. Our algorithm admits processing of such data size in time steps \(\sim {\mathcal{C}}\times {({\mathrm{log}\,}_{2}(N))}^{2}\sqrt{N}\), where \({\mathcal{C}}\, <\,20\) and N is the number of bits in the data. We hope the speedup provided by the quantum algorithm contributes to further advances in these areas.
Data availability
All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. Additional data related to this paper may be requested from the authors. Correspondence and requests for material should be addressed to Y.N. (nam@ionq.co).
References
Ramesh, H. & Vinay, V. String matching in O(nā+ām) quantum time. J. Discret. Algorithms 1, 103ā110 (2003).
Sasaki, M., Carlini, A. & Jozsa, R. Quantum template matching. Phys. Rev. A 64, 022317 (2001).
Landau, G. M. & Vishkin, U. Pattern matching in a digitized image. Algorithmica 12, 375ā408 (1994).
Bunke, H. & BĆ¼hler, U. Applications of approximate string matching to 2d shape recognition. Pattern Recognit. 26, 1797ā1812 (1993).
Chang, W. I. & Lawler, E. L. Sublinear approximate string matching and biological applications. Algorithmica 12, 327ā344 (1994).
Wyner, A. J. String Matching Theorems and Applications to Data Compression and Statistics. PhD Dissertation, (Stanford University, 1994).
Charras, C. & Lecroq, T. Handbook of Exact String Matching Algorithms. (Citeseer, 2004).
Singla, N. & Garg, D. String matching algorithms and their applicability in various applications. Int. J. Soft Comput. Eng. 1, 218ā222 (2012).
Knuth, D. E., Morris, J. H. Jr & Pratt, V. R. Fast pattern matching in strings. SIAM J. Comput. 6, 323ā350 (1977).
Hakak, S. I. et al. Exact string matching algorithms: Survey, issues, and future research directions. IEEE Access 7, 69614ā69637 (2019).
Yao, A. C. C. The complexity of pattern matching for a random string. SIAM J. Comput. 8, 368ā387 (1979).
Kuperberg, G. A subexponentialtime quantum algorithm for the dihedral hidden subgroup problem. SIAM J. Comput. 35, 170ā188 (2005).
Montanaro, A. Quantum pattern matching fast on average. Algorithmica 77, 16ā39 (2017).
Brassard, G., Hoyer, P., Mosca, M. & Tapp, A. Quantum amplitude amplification and estimation. Quantum Computation and Information Vol. 305 of AMS Contemporary Mathematics Series (eds Lomonaco, S. J. & Brandt, H. E.) 53ā74, 2002.
Childs, A. M., Maslov, D., Nam, Y., Ross, N. J. & Su, Y. Toward the first quantum simulation with quantum speedup. Proc. Natl. Acad. Sci. USA 115, 9456ā9461 (2018).
Giovannetti, V., Lloyd, S. & Maccone, L. Quantum random access memory. Phys. Rev. Lett. 100, 160501 (2008).
Park, D. K., Petruccione, F. & Rhee, J. K. K. Circuitbased quantum random access memory for classical data. Sci. Rep. 9, 1ā8 (2019).
Rasmussen, S. E., Groenland, K., Gerritsma, R., Schoutens, K. & Zinner, N. T. Singlestep implementation of highfidelity n bit toffoli gates. Phys. Rev. A 101, 022308 (2020).
Nam, Y., Ross, N. J., Su, Y., Childs, A. M. & Maslov, D. Automated optimization of large quantum circuits with continuous parameters. npj Quantum Inf. 4, 1ā12 (2018).
Nam, Y. et al. Groundstate energy estimation of the water molecule on a trappedion quantum computer. npj Quantum Inf. 6, 33 (2020).
Maslov, D. Advantages of using relativephase Toffoli gates with an application to multiple control Toffoli optimization. Phys. Rev. A 93, 022311 (2016).
Yuan, C., Heller, G. S., Rybakov, O., Ramaswamy, S., & Thomas, J. O. Object Recognition for Threedimensional Bodies, US Patent 9,424,461 (2016).
Chu, X., Lauber, J. A., & Runyon, J. R. Detecting Defects on a Wafer Using Template Image Matching, US Patent 9,311,698 (2016).
Owen, B. J. & Sathyaprakash, B. S. Matched filtering of gravitational waves from inspiraling compact binaries: computational cost and template placement. Phys. Rev. D 60, 022002 (1999).
Acknowledgements
The authors would like to thank Jae Pak at IonQ for helpful conversations. P.N. acknowledges funding by the DoE ASCR Accelerated Research in Quantum Computing program (award No. DESC0020312) and the DoE ASCR Quantum Testbed Pathfinder program (award No. DESC0019040).
Author information
Authors and Affiliations
Contributions
P.N. designed the algorithm under the supervision of Y.N. P.N. and Y.N. prepared the paper.
Corresponding authors
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisherās note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary information
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the articleās Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the articleās Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Niroula, P., Nam, Y. A quantum algorithm for string matching. npj Quantum Inf 7, 37 (2021). https://doi.org/10.1038/s41534021003693
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41534021003693