Abstract
Crochemore and Perrin discovered an elegant linear-time constant-space string matching algorithm that makes at most 2n−m symbol comparison. This paper shows how to modify their algorithm to use fewer comparisons.
Given any fixed ε>0, the new algorithm takes linear time, uses constant space and makes at most n+[1+ε/2(n−m)] symbol comparisons. If O(log m) space is available, then the algorithm makes at most n + [1/2(n − m)] symbol comparisons. The pattern preprocessing step also takes linear time and uses constant space.
These are the first string matching algorithms that make fewer than 2n & -m symbol comparisons and use sub-linear space.
Partially supported by the IBM Graduate Fellowship while studying at Columbia University in New York and by the European Research Consortium for Informatics and Mathematics postdoctoral fellowship while staying at the Centrum voor Wiskunde en Informatica in Amsterdam, The Netherlands. Part of this work was done while visiting at Università de L'Aquila, L'Aquila, Italy in summer 1991.
Preview
Unable to display preview. Download preview PDF.
References
A. Apostolico and R. Giancarlo. The Boyer-Moore-Galil string searching strategies revisited. SIAM J. Comput., 15(1):98–105, 1986.
A. B. Borodin, M. J. Fischer, D. G. Kirkpatrick, N. A. Lynch, and M. Tompa. A time-space tradeoff for sorting on non-oblivious machines. In Proc. 20th IEEE Symp. on Foundations of Computer Science, pages 294–301, 1979.
R.S. Boyer and J.S. Moore. A fast string searching algorithm. Comm. of the ACM, 20:762–772, 1977.
D. Breslauer and Z. Galil. Efficient Comparison Based String Matching. J. Complexity, 1993. To appear.
Y. Cesari and M. Vincent. Une caractérisation des mots periodiques. C.R. Acad. Sci. Paris, 286(A):1175–1177, 1978.
R. Cole. Tight bounds on the complexity of the Boyer-Moore pattern matching algorithm. In Proc. 2nd ACM-SIAM Symp. on Discrete Algorithms, pages 224–233, 1991.
R. Cole and R. Hariharan. Tighter Bounds on The Exact Complexity of String Matching. In Proc. 33rd IEEE Symp. on Foundations of Computer Science, pages 600–609, 1992.
R. Cole, R. Hariharan, M.S. Paterson, and U. Zwick. Which patterns are hard to find. In Proc. 2nd Israeli Symp. on Theoretical Computer Science, pages 59–68, 1993.
L. Colussi. Correctness and efficiency of string matching algorithms. Inform. and Control, 95:225–251, 1991.
M. Crochemore. String-matching on ordered alphabets. Theoret. Comput. Sci., 92:33–47, 1992.
M. Crochemore and D. Perrin. Two-way string-matching. J. Assoc. Comput. Mach., 38(3):651–675, 1991.
M. Crochemore and W. Rytter. Periodic Prefixes in Texts. In R. Capocelli, A. De Santis, and U. Vaccaro, editors, Proc. of the Sequences '91 Workshop: “Sequences II: Methods in Communication, Security and Computer Science”, pages 153–165. Springer-Verlag, 1993.
Z. Galil and R. Giancarlo. On the exact complexity of string matching: lower bounds. SIAM J. Comput., 20(6):1008–1020, 1991.
Z. Galil and R. Giancarlo. The exact complexity of string matching: upper bounds. SIAM J. Comput., 21(3):407–437, 1992.
Z. Galil and J. Seiferas. Saving space in fast string-matching. SIAM J. Comput., 2:417–438, 1980.
Z. Galil and J. Seiferas. Linear-time string-matching using only a fixed number of local storage locations. Theoret. Comput. Sci., 13:331–336, 1981.
Z. Galil and J. Seiferas. Time-space-optimal string matching. J. Comput. System Sci., 26:280–294, 1983.
L. Guibas and A. M. Odlyzko. Periods in strings. Journal of Combinatorial Theory, Series A, 30:19–42, 1981.
D.E. Knuth, J.H. Morris, and V.R. Pratt. Fast pattern matching in strings. SIAM J. Comput., 6:322–350, 1977.
M. Lothaire. Combinatorics on Words. Addison-Wesley, Reading, MA., U.S.A., 1983.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1993 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Breslauer, D. (1993). Saving comparisons in the Crochemore-Perrin string matching algorithm. In: Lengauer, T. (eds) Algorithms—ESA '93. ESA 1993. Lecture Notes in Computer Science, vol 726. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-57273-2_44
Download citation
DOI: https://doi.org/10.1007/3-540-57273-2_44
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-57273-2
Online ISBN: 978-3-540-48032-7
eBook Packages: Springer Book Archive