[go: up one dir, main page]

Skip to main content

Quantum String Matching Unfolded and Extended

  • Conference paper
  • First Online:
Reversible Computation (RC 2023)

Abstract

The string matching problem is one of the fundamental problems in computer science with applications in a variety of fields. Basically, it consists in finding all occurrences of a given pattern within a larger text. Despite its straightforward formulation, it has given rise to a huge number of solutions based on very different approaches and varied computational paradigms. But it is only very recently that the first solution based on quantum computation has been proposed by Niroula and Nam, allowing the problem to be solved in \(\mathcal {O}(\sqrt{n}(\log ^2(n)+\log (m)))\) time, with a quadratic speed-up compared to classical computation. To date, these two research fields have remained almost entirely separate, mainly because the technical aspects typical of the quantum computation field remain almost obscure to those involved in text processing. This paper aims to reconcile the two fields by unfolding the technical aspects of the Niroula-Nam quantum solution and providing a detailed general procedure working in \(\mathcal {O}(\sqrt{n}\log ^2(n))\) time that can be used as a framework for solving other string matching problems, including nonstandard ones. In this direction, the paper also proposes an extension of the algorithm to the approximate string matching problem with swaps, reporting the configuration of the occurrence together with its position, and achieving a quasi-linear \(\mathcal {O}(\sqrt{n}\log ^2(n))\) time complexity when \(m=\mathcal {O}(\log (n))\).

This work is partially funded by the National Centre for HPC, Big Data and Quantum Computing, Project CN00000013, affiliated to Spoke 10.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    If we assume to be able to implement the multi-controlled NOT gate in constant time [17], a Grover’s search on a dataset of n items achieves \(\mathcal {O}(\sqrt{n}T(n))\) time.

References

  1. Ambainis, A.: Quantum search algorithms. SIGACT News 35(2), 22–35 (2004)

    Article  Google Scholar 

  2. Balauca, S., Arusoaie, A.: Efficient constructions for simulating multi controlled quantum gates. In: Groen, D., et al. (eds.) Computational Science - ICCS 2022. LNCS, vol. 13353, pp. 179–194. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-08760-8_16

  3. Barenco, A., et al.: Elementary gates for quantum computation. Phys. Rev. A 52(5), 3457–3467 (1995)

    Article  Google Scholar 

  4. Beals, R., Buhrman, H., Cleve, R., Mosca, M., de Wolf, R.: Quantum lower bounds by polynomials. J. ACM 48(4), 778–797 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  5. Boyer, M., Brassard, G., Høyer, P., Tapp, A.: Tight bounds on quantum searching. Fortschr. Phys. 46(4–5), 493–505 (1998)

    Article  Google Scholar 

  6. Brassard, G., Høyer, P., Mosca, M., Tapp, A.: Quantum amplitude amplification and estimation. In: Lo Monaco, S.G., Brandt, H.E. (eds.) Quantum Computation and Information. Contemporary Mathematics, vol. 305, pp. 53–74. American Mathematical Society (2002)

    Google Scholar 

  7. Cantone, D., Faro, S.: Pattern matching with swaps for short patterns in linear time. In: Nielsen, M., Kučera, A., Miltersen, P.B., Palamidessi, C., Tůma, P., Valencia, F. (eds.) SOFSEM 2009. LNCS, vol. 5404, pp. 255–266. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-540-95891-8_25

    Chapter  Google Scholar 

  8. Fang, M., Fenner, S., Green, F., Homer, S., Zhang, Y.: Quantum lower bounds for fanout. Quantum Info. Comput. 6(1), 46–57 (2006)

    MathSciNet  MATH  Google Scholar 

  9. Faro, S., Pavone, A.: An efficient skip-search approach to swap matching. Comput. J. 61(9), 1351–1360 (2018)

    Article  MathSciNet  Google Scholar 

  10. Lov K. Grover. A fast quantum mechanical algorithm for database search. In: Proceedings of the Twenty-Eighth Annual ACM Symposium on Theory of Computing, STOC 1996, New York, NY, USA, pp. 212–219. ACM (1996)

    Google Scholar 

  11. He, Y., Luo, M., Zhang, E., Wang, H.-K., Wang, X.-F.: Decompositions of \(n\)-qubit Toffoli gates with linear circuit complexity. Int. J. Theor. Phys. 56, 07 (2017)

    Article  MathSciNet  MATH  Google Scholar 

  12. Høyer, P., Spalek, R.: Quantum fan-out is powerful. Theory C. 1, 81–103 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  13. Knuth, D.E., Morris, J.H., Jr., Pratt, V.R.: Fast pattern matching in strings. SIAM J. Comput. 6(2), 323–350 (1977)

    Article  MathSciNet  MATH  Google Scholar 

  14. Montanaro, A.: Quantum pattern matching fast on average. Algorithmica 77(1), 16–39 (2017)

    Article  MathSciNet  MATH  Google Scholar 

  15. Niroula, P., Nam, Y.: A quantum algorithm for string matching. NPJ Quant. Inf. 7, 37 (2021)

    Article  Google Scholar 

  16. Ramesh, H., Vinay, V.: String matching in \({\tilde{o}}(\sqrt{n}+\sqrt{m})\) quantum time. J. Discr. Algorithms 1(1), 103–110 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  17. Rasmussen, S.E., Groenland, K., Gerritsma, R., Schoutens, K., Zinner, N.T.: Single-step implementation of high-fidelity \(n\)-bit Toffoli gates. Phys. Rev. A 101, 022308 (2020)

    Article  Google Scholar 

  18. Shor, P.W.: Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM J. Comp. 26(5), 1484–1509 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  19. Toffoli, T.: Reversible computing. In: de Bakker, J., van Leeuwen, J. (eds.) ICALP 1980. LNCS, vol. 85, pp. 632–644. Springer, Heidelberg (1980). https://doi.org/10.1007/3-540-10003-2_104

    Chapter  Google Scholar 

  20. Yao, A.C.: The complexity of pattern matching for a random string. Technical report, Stanford, CA, USA (1977)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Simone Faro .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Cantone, D., Faro, S., Pavone, A. (2023). Quantum String Matching Unfolded and Extended. In: Kutrib, M., Meyer, U. (eds) Reversible Computation. RC 2023. Lecture Notes in Computer Science, vol 13960. Springer, Cham. https://doi.org/10.1007/978-3-031-38100-3_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-38100-3_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-38099-0

  • Online ISBN: 978-3-031-38100-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics