An improved pattern matching algorithm for strings in terms of straight-line programs
We show an efficient pattern-matching algorithm for strings that are succinctly described in terms of straight-line programs, in which the constants are symbols and the only operation is the concatenation. In this paper, both text T and pattern P are given by straight-line programs T and P. The length of the text T (pattern P, resp.) may grow exponentially with respect to its description size ‖T‖=n (‖p‖=m, resp.). We show a new combinatorial property concerning with the periodic occurrences of a pattern in a text. Based on this property, we develop an O(n2m2) time algorithm using O(nm) space, which outputs a compact representation of all occurrences of P in T. This is superior to the algorithm proposed by Karpinski et al. , which runs in O((n+m)4 log (n+m)) time using O((n+m)3) space, and finds only one occurrence. Moreover, our algorithm is much simpler than theirs.
KeywordsPattern Match Compact Representation Recursive Call Function Match Membership Query
Unable to display preview. Download preview PDF.
- 1.A. Amir and G. Benson. Efficient two-dimensional compressed matching. In Proc. Data Compression Conference, page 279, 1992.Google Scholar
- 2.A. Amir and G. Benson. Two-dimensional periodicity and its application. In Proc. 3rd Symposium on Discrete Algorithms, page 440, 1992.Google Scholar
- 3.A. Amir, G. Benson, and M. Farach. Optimal two-dimensional compressed matching. In Proc. 21st International Colloquium on Automata, Languages and Programming, 1994.Google Scholar
- 4.A. Amir, G. Benson, and M. Farach. Let sleeping files lie: Pattern matching in Z-compressed files. Journal of Computer and System Sciences, 52:299–307, 1996.Google Scholar
- 5.A. Amir, G. M. Landau, and U. Vishkin. Efficient pattern matching with scaling. Journal of Algorithms, 13(1):2–32, 1992.Google Scholar
- 6.T. Eilam-Tsoreff and U. Vishkin. Matching patterns in a string subject to multilinear transformations. In Proc. International Workshop on Sequences, Combinatorics, Compression, Security and Transmission, 1988.Google Scholar
- 7.M. Farach and M. Thorup. String-matching in Lempel-Ziv compressed strings. In 27th ACM STOC, pages 703–713, 1995.Google Scholar
- 8.L. Gasieniec, M. Karpinski, W. Plandowski, and W. Rytter. Efficient algorithms for Lempel-Ziv encoding. In Proc. 4th Scandinavian Workshop on Algorithm Theory, volume 1097 of Lecture Notes in Computer Science, pages 392–403. Springer-Verlag, 1996.Google Scholar
- 9.L. Gasieniec, M. Karpinski, W. Plandowski, and W. Rytter. Randomized efficient algorithms for compressed strings: the finger-print approach. In Proc. Combinatorial Pattern Matching, volume 1075 of Lecture Notes in Computer Science, pages 39–49. Springer-Verlag, 1996.Google Scholar
- 10.M. Karpinski, W. Rytter, and A. Shinohara. Pattern-matching for strings with short descriptions. In Proc. Combinatorial Pattern Matching, volume 637 of Lecture Notes in Computer Science, pages 205–214. Springer-Verlag, 1995.Google Scholar
- 11.M. Karpinski, W. Rytter, and A. Shinohara. An efficient pattern-matching algorithm for strings with short descriptions. Nordic Journal of Computing, 1997. (to appear).Google Scholar