Skip to main content

Constant-Time Word-Size String Matching

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7354))

Abstract

We present a novel string-matching algorithm that requires constant time for text scanning in an unusual model where (a) the input pattern and text are each packed into a single word, (b) the output is a one word bit-mask identifying the pattern occurrences in the text, and (c) there are constant-time arithmetic, bitwise, and shift instructions that operate on words whose size is proportional to the arbitrarily long input length. Our bit-parallelism techniques build upon and also greatly simplify existing parallel random access machine algorithms by using two “simple structure” rather than “small size” deterministic samples, i.e., one deterministic sample is very small (size two), while the other is a potentially very long prefix of the pattern. Pattern preprocessing takes time proportional to the word size. Our results also establish, by recent reductions, new bounds for the packed string matching problem.

Work partially supported by the European Research Council (ERC) project SFEROT, and by the Israeli Science Foundation Grants 686/07, 347/09 and 864/11, and by Italian project PRIN AlgoDEEP (2008TFBWL4) of MIUR.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Baeza-Yates, R.A.: Improved string searching. Softw. Pract. Exper. 19(3), 257–271 (1989)

    Article  MathSciNet  Google Scholar 

  2. Belazzougui, D.: Worst Case Efficient Single and Multiple String Matching in the RAM Model. In: Iliopoulos, C.S., Smyth, W.F. (eds.) IWOCA 2010. LNCS, vol. 6460, pp. 90–102. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  3. Ben-Kiki, O., Bille, P., Breslauer, D., Gąsieniec, L., Grossi, R., Weimann, O.: Optimal Packed String Matching. In: Proc. FSTTCS. LIPIcs, vol. 13, pp. 423–432. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2011)

    Google Scholar 

  4. Klein, S.T., Kopel Ben-Nissan, M.: Accelerating Boyer Moore Searches on Binary Texts. In: Holub, J., Žďárek, J. (eds.) CIAA 2007. LNCS, vol. 4783, pp. 130–143. Springer, Heidelberg (2007)

    Chapter  Google Scholar 

  5. Bille, P.: Fast searching in packed strings. J. Discrete Algorithms 9(1), 49–56 (2011)

    Article  MathSciNet  MATH  Google Scholar 

  6. Boyer, R., Moore, J.: A fast string searching algorithm. Comm. of the ACM 20, 762–772 (1977)

    Article  MATH  Google Scholar 

  7. Breslauer, D., Czumaj, A., Dubhashi, D.P., Meyer auf der Heide, F.: Comparison Model Lower Bounds to the Parallel-Random-Access-Machine. Inf. Process. Lett. 62(2), 103–110 (1997)

    Article  MathSciNet  Google Scholar 

  8. Breslauer, D., Galil, Z.: An optimal O(loglogn) time parallel string matching algorithm. SIAM J. Comput. 19(6), 1051–1058 (1990)

    Article  MathSciNet  MATH  Google Scholar 

  9. Breslauer, D., Galil, Z.: A Lower Bound for Parallel String Matching. SIAM J. Comput. 21(5), 856–862 (1992)

    Article  MathSciNet  MATH  Google Scholar 

  10. Cole, R., Crochemore, M., Galil, Z., Gąsieniec, L., Hariharan, R., Muthukrishnan, S., Park, K., Rytter, W.: Optimally fast parallel algorithms for preprocessing and pattern matching in one and two dimensions. In: Proc. FOCS, pp. 248–258 (1993)

    Google Scholar 

  11. Crochemore, M., Galil, Z., Gąsieniec, L., Park, K., Rytter, W.: Constant-Time Randomized Parallel String Matching. SIAM J. Comput. 26(4), 950–960 (1997)

    Article  MathSciNet  MATH  Google Scholar 

  12. Czumaj, A., Galil, Z., Gąsieniec, L., Park, K., Plandowski, W.: Work-time-optimal parallel algorithms for string problems. In: Proc. STOC, pp. 713–722. ACM (1995)

    Google Scholar 

  13. Faro, S., Lecroq, T.: Efficient pattern matching on binary strings. In: Proc. SOFSEM (2009)

    Google Scholar 

  14. Fich, F.E.: Constant Time Operations for Words of Length w. Technical report, University of Toronto (1999), http://www.cs.toronto.edu/~faith/algs.ps

  15. Fredriksson, K.: Faster String Matching with Super-Alphabets. In: Laender, A.H.F., Oliveira, A.L. (eds.) SPIRE 2002. LNCS, vol. 2476, pp. 44–57. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  16. Fredriksson, K.: Shift-or string matching with super-alphabets. IPL 87(4), 201–204 (2003)

    Article  MathSciNet  MATH  Google Scholar 

  17. Furst, M.L., Saxe, J.B., Sipser, M.: Parity, circuits, and the polynomial-time hierarchy. Mathematical Systems Theory 17(1), 13–27 (1984)

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  19. Galil, Z.: A Constant-Time Optimal Parallel String-Matching Algorithm. J. ACM 42(4), 908–918 (1995)

    Article  MathSciNet  MATH  Google Scholar 

  20. Gąsieniec, L., Plandowski, W., Rytter, W.: Constant-space String Matching with Smaller Number of Comparisons: Sequential Sampling. In: Galil, Z., Ukkonen, E. (eds.) CPM 1995. LNCS, vol. 937, pp. 78–89. Springer, Heidelberg (1995)

    Chapter  Google Scholar 

  21. Goldberg, T., Zwick, U.: Faster parallel string matching via larger deterministic samples. J. Algorithms 16(2), 295–308 (1994)

    Article  MathSciNet  MATH  Google Scholar 

  22. Knuth, D., Morris, J., Pratt, V.: Fast pattern matching in strings. SIAM J. Comput. 6, 322–350 (1977)

    Article  MathSciNet  Google Scholar 

  23. Knuth, D.E.: Combinatorial Algorithms. The Art of Computer Programming, vol. 4A. Addison-Wesley Professional (January 2011)

    Google Scholar 

  24. Navarro, G., Raffinot, M.: A Bit-Parallel Approach to Suffix Automata: Fast Extended String Matching. In: Farach-Colton, M. (ed.) CPM 1998. LNCS, vol. 1448, pp. 14–33. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  25. Tarhio, J., Peltola, H.: String matching in the DNA alphabet. Software Practice Experience 27, 851–861 (1997)

    Article  Google Scholar 

  26. Vishkin, U.: Optimal parallel pattern matching in strings. Inform. and Control 67, 91–113 (1985)

    Article  MathSciNet  MATH  Google Scholar 

  27. Vishkin, U.: Deterministic sampling - A new technique for fast pattern matching. SIAM J. Comput. 20(1), 22–40 (1990)

    Article  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Breslauer, D., Gąsieniec, L., Grossi, R. (2012). Constant-Time Word-Size String Matching. In: Kärkkäinen, J., Stoye, J. (eds) Combinatorial Pattern Matching. CPM 2012. Lecture Notes in Computer Science, vol 7354. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-31265-6_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-31265-6_7

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-31264-9

  • Online ISBN: 978-3-642-31265-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics