Skip to main content

Constant-space string matching with smaller number of comparisons: sequential sampling

  • Conference paper
  • First Online:
Combinatorial Pattern Matching (CPM 1995)

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

Included in the following conference series:

Abstract

A new string-matching algorithm working in constant space and linear time is presented. It is based on a powerful idea of sampling, originally introduced in parallel computations. The algorithm uses a sample S which consists of two positions inside the pattern P. First the positions of the sample S are tested against the corresponding positions of the text T, then a version of Knuth-Morris-Pratt algorithm is applied. This gives the simplest known string-matching algorithm which works in constant space and linear time and which does not use any linear order of the alphabet. A refined version of the algorithm gives the fastest (in the sense of number of comparisons) known algorithm for string-matching in constant space. It makes (1+ε)n+O(n/m) symbol comparisons. This improves substantially the result of [3], where a (3/2+ε)n comparisons constant space algorithm was designed. Additionally, our preprocessing to this algorithm makes only (1+ε)m+O(1/ε) comparisons and uses constant space.

Supported partially by the KBN grant.

Supported partially by the DFG grant.

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. A.V. Aho, Algorithms for Finding Patterns in Strings. In Handbook of Theoretical Computer Science, p. 257–300. Elsevier Science Publishers B. V., Amsterdam, The Netherlands, 1990.

    Google Scholar 

  2. D. Breslauer, private communication.

    Google Scholar 

  3. D. Breslauer, Saving Comparisons in the Crochemore-Perrin String Matching Algorithm. In Proc. of 1st European Symp. on Algorithms, p. 61–72, 1993.

    Google Scholar 

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

    Article  Google Scholar 

  5. R. Cole, R. Hariharan, Tighter bounds on the exact complexity of string matching. In Proc. of 33rd Annual Symp. on Foundations of Comp. Sci., p. 600–609, 1992.

    Google Scholar 

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

    Google Scholar 

  7. M. Crochemore, L. Gasieniec, W. Plandowski and W. Rytter, Two-dimensional pattern matching in small time and space, in Proc. of STACS'95, Springer-Verlag, 1995.

    Google Scholar 

  8. M. Crochemore, String-matching on ordered alphabets. Theoret. Comput. Sci., 92, p. 33–47, 1992.

    Google Scholar 

  9. M. Crochemore and D. Perrin, Two-way string-matching. J. Assoc. Comput. Mach., 38(3), p. 651–675, 1991.

    Google Scholar 

  10. M. Crochemore and W. Rytter, Periodic Prefixes in Texts. In Proc. of Sequences'91 Workshop ”Sequences II: Methods in Communication, Security and Computer Science”, p. 153–165, Springer-Verlag, 1993.

    Google Scholar 

  11. M. Crochemore and W. Rytter, Text algorithms, Oxford University Press, New York, 1994

    Google Scholar 

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

    Google Scholar 

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

    Google Scholar 

  14. Z. Galil and J. Seiferas, Time-space-optimal string matching. J. Comput. System Sci., 26, p. 280–294, 1983.

    Google Scholar 

  15. L. Gasieniec, W. Plandowski and W. Rytter, The zooming method: a recursive approach to time-space efficient string-matching. Theoret. Comput. Sci., to appear.

    Google Scholar 

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

    Article  Google Scholar 

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

    Google Scholar 

  18. U. Vishkin, Deterministic sampling — a new technique for fast pattern matching, SIAM J. Comput.,20, p. 22–40, 1991.

    MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Zvi Galil Esko Ukkonen

Rights and permissions

Reprints and permissions

Copyright information

© 1995 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gasieniec, L., Plandowski, W., Rytter, W. (1995). Constant-space string matching with smaller number of comparisons: sequential sampling. In: Galil, Z., Ukkonen, E. (eds) Combinatorial Pattern Matching. CPM 1995. Lecture Notes in Computer Science, vol 937. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-60044-2_36

Download citation

  • DOI: https://doi.org/10.1007/3-540-60044-2_36

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-60044-2

  • Online ISBN: 978-3-540-49412-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics