Skip to main content

Two-dimensional pattern matching in linear time and small space

Extended abstract

  • Conference paper
  • First Online:
STACS 95 (STACS 1995)

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

Included in the following conference series:

  • 913 Accesses

Abstract

We present the first known (alphabet independent) algorithm for two-dimensional pattern matching which works in linear time and small space simultaneously. The searching phase of our algorithm works in O(1) space and is followed by pattern preprocessing performed in O(logm) space. Up to now there was not known even any efficient sublinear space algorithm for this problem. The main tools in our algorithm are several 2-dimensional variations of deterministic sampling, originally used in parallel pattern matching: small, frame and wide samples. Another novel idea used in our algorithm is the technique of zooming sequences: the sequences of nonperiodic decreasing parts of the pattern (samples) of similar regular shapes. Their regularity allows to encode the zooming sequences in small memory (logarithmic number of bits) while nonperiodicity allows to make shifts (kill positions as candidates for a match) in a way amortizing the work. The preprocessing phase is recursive, its structure is similar to the linear time algorithm for the selection problem. The stack of the recursion consists of logarithmic number of integers. Our algorithm is rather complicated, but all known alphabet-independent linear time algorithms (even with unrestricted space) for 2d-matching are quite complicated, too.

Supported by the Grant KBN 2-1190-91-01

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.

Similar content being viewed by others

References

  1. A. Amir and G. Benson, Two dimensional periodicity and its applications, Proc. 3rd ACM-SIAM SODA'92, p. 440–452.

    Google Scholar 

  2. A. Amir, G. Benson and M. Farach, Alphabet independent two dimensional matching, Proc. 24th ACM STOC'92, p. 59–68.

    Google Scholar 

  3. A. Amir, G. Benson and M. Farach, Optimal parallel two dimensional pattern matching, Proc. 5th ACM SPAA'93, p. 79–85.

    Google Scholar 

  4. T. J. Baker, A technique for extending rapid exact-match string matching to arrays of more than one dimension, SIAM J. Comp. 7 (1978), p. 533–541.

    Google Scholar 

  5. R. S. Bird, Two dimensional pattern matching, Inf. Proc. Letters 6, (1977) p. 168–170.

    Google Scholar 

  6. 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, Proc. 34th IEEE FOCS'93, p. 248–258.

    Google Scholar 

  7. M. Crochemore, String matching for ordered alphabets, TCS 92 (1992), p. 225–251.

    Google Scholar 

  8. M. Crochemore and D. Perrin, Two-way string matching, JACM 38:3 (1991), p. 651–675.

    Google Scholar 

  9. M. Crochemore, L. Gasieniec and W. Rytter, Two-dimensional pattern matching by sampling, IPL 46 (1993), p. 159–162.

    Google Scholar 

  10. M. Crochemore and W. Rytter, A version of Galil-Park two-dimensional matching, Report IGM 94-05, Universite Marne la Valle (1994).

    Google Scholar 

  11. Z. Galil and K. Park, Truly alphabet independent two dimensional matching, Proc. 33th IEEE FOCS'92, (1992) p. 247–256.

    Google Scholar 

  12. Z. Galil and J. Seiferas, Time-space optimal string matching, J. Comp. Syst. Sc. 26 (1983), p. 280–294.

    Google Scholar 

  13. L. Gasieniec, W. Plandowski and W. Rytter, The zooming method: a recursive approach to time-space efficient string-matching, TCS, to appear.

    Google Scholar 

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

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Ernst W. Mayr Claude Puech

Rights and permissions

Reprints and permissions

Copyright information

© 1995 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Crochemore, M., Gasieniec, L., Rytter, W., Plandowski, W. (1995). Two-dimensional pattern matching in linear time and small space. In: Mayr, E.W., Puech, C. (eds) STACS 95. STACS 1995. Lecture Notes in Computer Science, vol 900. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-59042-0_72

Download citation

  • DOI: https://doi.org/10.1007/3-540-59042-0_72

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

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

  • Online ISBN: 978-3-540-49175-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics