Skip to main content

On the exact complexity of the string prefix-matching problem

Extended abstract

  • Conference paper
  • First Online:
Algorithms — ESA '94 (ESA 1994)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 855))

Included in the following conference series:

  • 154 Accesses

Abstract

In this paper we study the exact comparison complexity of the string prefix-matching problem in the deterministic sequential comparison model with equality tests. We derive almost tight lower and upper bounds on the number of comparisons required in the worst case by on-line prefix-matching algorithms for any fixed pattern and variable text. Unlike previous results on the comparison complexity of string-matching and prefix-matching algorithms, our bounds are almost tight for any particular pattern.

We also consider the special case where the pattern and the text are the same string. This problem, which we call the string self-prefix problem, is similar to the pattern preprocessing step of the Knuth-Morris-Pratt string-matching algorithm that is used in several comparison efficient string-matching and prefix-matching algorithms, including in our new algorithm. We develop an algorithm for the self-prefix problem that requires at most 2m−⌈2√m⌉ comparisons, matching the lower bound that we gave in a previous work.

Our algorithms can be implemented in linear-time and space in the standard random-access-machine model.

Partially supported by ESPRIT Basic Research Action Program of the EC under contract #7141 (ALCOM II). Part of the research reported in the paper was carried out while this author was visiting at the Istituto di Elaborazione dell'Informazione, Consiglio Nazionale delle Ricerche, Pisa, Italy, with the support of the European Research Consortium for Informatics and Mathematics postdoctoral fellowship.

Partially supported by “Progetto Finalizzato Sistemi Informatici e Calcolo Parallelo” of the Italian National Research Councile under grant number 89.00026.69.

Partially supported by “Borsa di studi per attività di perfeziomento all'estero” from the University of Padua.

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

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. R.S. Boyer and J.S. Moore. A fast string searching algorithm. Comm. of the ACM, 20:762–772, 1977.

    Article  Google Scholar 

  2. D. Breslauer. Fast Parallel String Prefix-Matching. Technical Report CUCS-041-92, Computer Science Dept., Columbia University, 1992.

    Google Scholar 

  3. D. Breslauer, L. Colussi, and L. Toniolo. Tight Comparison Bounds for the String Prefix-Matching Problem. Inform. Process. Lett., 47(1):51–57, 1993.

    Article  MathSciNet  Google Scholar 

  4. D. Breslauer and Z. Galil. Efficient Comparison Based String Matching. J. Complexity, 9(3):339–365, 1993.

    Article  MathSciNet  Google Scholar 

  5. R. Cole, M. Crochemore, Z. Galil, L. Gasieniec, R. Hariharan, S. Muthukrishnan, K. Park, and W. Rytter. Optimally fast parallel algorithms for preprocessing and pattern matching in one and two dimensions. In Proc. 34th IEEE Symp. on Foundations of Computer Science, pages 248–258, 1993.

    Google Scholar 

  6. R. Cole and R. Hariharan. Tighter Bounds on the Exact Complexity of String Matching. In Proc. 33rd IEEE Symp. on Foundations of Computer Science, pages 600–609, 1992.

    Google Scholar 

  7. R. Cole, R. Hariharan, M.S. Paterson, and U. Zwick. Which patterns are hard to find. In Proc. 2nd Israeli Symp. on Theory of Computing and Systems, pages 59–68, 1993.

    Google Scholar 

  8. L. Colussi. Correctness and efficiency of string matching algorithms. Inform. and Control, 95:225–251, 1991.

    MATH  MathSciNet  Google Scholar 

  9. Z. Galil. Optimal parallel algorithms for string matching. Inform. and Control, 67:144–157, 1985.

    Article  MATH  MathSciNet  Google Scholar 

  10. Z. Galil and R. Giancarlo. On the exact complexity of string matching: lower bounds. SIAM J. Comput., 20(6):1008–1020, 1991.

    MathSciNet  Google Scholar 

  11. Z. Galil and R. Giancarlo. The exact complexity of string matching: upper bounds. SIAM J. Comput., 21(3):407–437, 1992.

    Article  MathSciNet  Google Scholar 

  12. Z. Galil and K. Park. Truly Alphabet-Independent Two-Dimensional Pattern Matching. In Proc. 33th IEEE Symp. on Foundations of Computer Science, pages 247–256, 1992.

    Google Scholar 

  13. L. Gasieniec and K. Park. Fully Optimal Parallel Prefix Matching. This conference proceedings.

    Google Scholar 

  14. C. Hancart. On Simon's string searching algorithm. Inform. Process. Lett., 47(2):95–99, 1993.

    Article  MATH  MathSciNet  Google Scholar 

  15. R. Hariharan and S. Muthukrishnan. Optimal Parallel Algorithms for Prefix Matching. In Proc. 21th International Colloquium on Automata, Languages, and Programming. To appear.

    Google Scholar 

  16. D.E. Knuth, J.H. Morris, and V.R. Pratt. Fast pattern matching in strings. SIAM J. Comput., 6:322–350, 1977.

    Article  MathSciNet  Google Scholar 

  17. M. Lothaire. Combinatorics on Words. Addison-Wesley, Reading, MA., U.S.A., 1983.

    Google Scholar 

  18. G.M. Main and R.J. Lorentz. An O(n log n) algorithm for finding all repetitions in a string. J. Algorithms, 5:422–432, 1984.

    Article  MathSciNet  Google Scholar 

  19. R.V. Rivest. On the Worst Case Behavior of String-Searching Algorithms. SIAM J. Comput., 6:669–674, 1977.

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Jan van Leeuwen

Rights and permissions

Reprints and permissions

Copyright information

© 1994 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Breslauer, D., Colussi, L., Toniolo, L. (1994). On the exact complexity of the string prefix-matching problem. In: van Leeuwen, J. (eds) Algorithms — ESA '94. ESA 1994. Lecture Notes in Computer Science, vol 855. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0049433

Download citation

  • DOI: https://doi.org/10.1007/BFb0049433

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-58434-6

  • Online ISBN: 978-3-540-48794-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics