Abstract
This paper concentrates on the problem of finding all the occurrences of a pattern in a text. A novel bit-parallel exact string matching algorithm for small alphabet (SABP) is proposed based on a position related character matching table, which is deduced according to the matching matrix of the pattern and the text. A 2-base logarithm table consisting of 216 items is employed to locate the leftmost “1” bit of an unsigned integer flag, which indicates a latest probable occurrence of the pattern in the text. Safe shifts are obtained through combining the 2-base logarithm table value of current flag and the bad character shift which is adopted in Boyer-Moore algorithm. Our algorithm suits to the situation that the pattern length is more than the word size of a computer. Experimental results on random generated texts show that it is the fastest in many cases, particularly, on long patterns with a small alphabet.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Charras, C., Lecroq, T.: Exact string matching algorithms. King’s College Publications (2004)
Knuth, D.E., Morris, J., Pratt, V.: Fast pattern matching in strings. SIAM Journal on Computing 6, 323–350 (1977)
Baeza-Yates, R., Gonnet, G.: A new approach to text searching. Communications of the ACM 35, 74–82 (1992)
Boyer, R., Moore, S.: A fast string searching algorithm. Communications of the ACM 20, 762–772 (1977)
Horspool, R.N.: Practical fast searching in strings. Software Practice and Experience 10, 501–506 (1980)
Crochemore, M., Czumaj, A., Gąsieniec, L., Jarominek, S., Lecroq, T., Plandowski, W., Rytter, W.: Speeding up two string-matching algorithms. Algorithmica 12, 247–267 (1994)
Navarro, G., Raffinot, M.: Fast and flexible string matching by combining bit-parallelism and suffix automata. ACM Journal of Experimental Algorithmics 5 (2000), http://www.jea.acm.org/2000/NavarroString
Ďurian, B., Holub, J., Peltola, H., Tarhio, J.: Tuning BNDM with q-Grams. In: Proc. ALENEX 2009, Tenth Workshop on Algorithm Engineering and Experiments. SIAM 2009, pp. 29–37 (2009)
Allauzen, C., Crochemore, M., Raffinot, M.: Efficient experimental string matching by weak factor recognition. In: Amir, A., Landau, G.M. (eds.) CPM 2001. LNCS, vol. 2089, pp. 51–72. Springer, Heidelberg (2001)
Faro, S., Lecroq, T.: Efficient Variants of the Backward-Oracle-Matching Algorithm. In: Prague Stringology Conference 2008, pp. 146–160 (2008)
Karp, R.M., Rabin, M.O.: Efficient randomized pattern-matching algorithms. IBM J. Res. Dev. 31, 249–260 (1987)
Lecroq, T.: Fast exact string matching algorithms. Information Processing Letters 102, 229–235 (2007)
Fredriksson, K.: Shift-or string matching with super-alphabets. Information Processing Letters 87, 201–204 (2003)
Fredriksson, K., Grabowski, S.: Practical and optimal string matching. In: Consens, M.P., Navarro, G. (eds.) SPIRE 2005. LNCS, vol. 3772, pp. 376–387. Springer, Heidelberg (2005)
Prasad, R., Agarwal, S.: A new parameterized string matching algorithm by combining bit-parallelism and suffix automata. In: Institute of Electrical and Electronics Engineers Computer Society, Piscataway, NJ 08855-1331, United States, pp. 778–783 (2008)
Külekci, M.O.: TÜBİTAK-UEKAE: A Method to Overcome Computer Word Size Limitation in Bit-Parallel Pattern Matching. In: Hong, S.-H., Nagamochi, H., Fukunaga, T. (eds.) ISAAC 2008. LNCS, vol. 5369, pp. 496–506. Springer, Heidelberg (2008)
Canterbury Corpus Database (2009), http://corpus.canterbury.ac.nz/descriptions/
Navarro, G., Raffinot, M.: String Matching. Flexible Pattern Matching in Strings: Practical On-line Search Algorithms for Texts and Biological Sequences. Cambridge University Press, Cambridge (2002)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Zhang, G., Zhu, E., Mao, L., Yin, M. (2009). A Bit-Parallel Exact String Matching Algorithm for Small Alphabet. In: Deng, X., Hopcroft, J.E., Xue, J. (eds) Frontiers in Algorithmics. FAW 2009. Lecture Notes in Computer Science, vol 5598. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-02270-8_34
Download citation
DOI: https://doi.org/10.1007/978-3-642-02270-8_34
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-02269-2
Online ISBN: 978-3-642-02270-8
eBook Packages: Computer ScienceComputer Science (R0)