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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Baeza-Yates, R.A.: Improved string searching. Softw. Pract. Exper. 19(3), 257–271 (1989)
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)
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)
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)
Bille, P.: Fast searching in packed strings. J. Discrete Algorithms 9(1), 49–56 (2011)
Boyer, R., Moore, J.: A fast string searching algorithm. Comm. of the ACM 20, 762–772 (1977)
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)
Breslauer, D., Galil, Z.: An optimal O(loglogn) time parallel string matching algorithm. SIAM J. Comput. 19(6), 1051–1058 (1990)
Breslauer, D., Galil, Z.: A Lower Bound for Parallel String Matching. SIAM J. Comput. 21(5), 856–862 (1992)
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)
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)
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)
Faro, S., Lecroq, T.: Efficient pattern matching on binary strings. In: Proc. SOFSEM (2009)
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
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)
Fredriksson, K.: Shift-or string matching with super-alphabets. IPL 87(4), 201–204 (2003)
Furst, M.L., Saxe, J.B., Sipser, M.: Parity, circuits, and the polynomial-time hierarchy. Mathematical Systems Theory 17(1), 13–27 (1984)
Galil, Z.: Optimal parallel algorithms for string matching. Inform. and Control 67, 144–157 (1985)
Galil, Z.: A Constant-Time Optimal Parallel String-Matching Algorithm. J. ACM 42(4), 908–918 (1995)
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)
Goldberg, T., Zwick, U.: Faster parallel string matching via larger deterministic samples. J. Algorithms 16(2), 295–308 (1994)
Knuth, D., Morris, J., Pratt, V.: Fast pattern matching in strings. SIAM J. Comput. 6, 322–350 (1977)
Knuth, D.E.: Combinatorial Algorithms. The Art of Computer Programming, vol. 4A. Addison-Wesley Professional (January 2011)
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)
Tarhio, J., Peltola, H.: String matching in the DNA alphabet. Software Practice Experience 27, 851–861 (1997)
Vishkin, U.: Optimal parallel pattern matching in strings. Inform. and Control 67, 91–113 (1985)
Vishkin, U.: Deterministic sampling - A new technique for fast pattern matching. SIAM J. Comput. 20(1), 22–40 (1990)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)