Small-Space 2D Compressed Dictionary Matching

The dictionary matching problem seeks all locations in a text that match any of the patterns in a dictionary. In the compressed dictionary matching problem, the input is in compressed form. In this paper we introduce the 2-dimensional compressed dictionary matching problem in Lempel-Ziv compressed images, and present an efficient solution for patterns whose rows are all periodic. Given k patterns, each of (uncompressed) size m×m, and a text of (uncompressed) size n×n, all in 2D-LZ compressed form, our algorithm finds all occurrences of the patterns in the text. The algorithm is strongly inplace, i.e., the extra space it uses is proportional to the optimal compression of the dictionary, which is O(km). The preprocessing time of the algorithm is O(km2), linear in the uncompressed dictionary size, and the time for performing the search is linear in the uncompressed text size, independent of the dictionary size. Our algorithm is general in the sense that it can be used for any 2D compression scheme which can be sequentially decompressed in small space.

[1]  Alfred V. Aho,et al.  Efficient string matching , 1975, Commun. ACM.

[2]  Amihood Amir,et al.  Two-Dimensional Dictionary Matching , 1992, Inf. Process. Lett..

[3]  Wojciech Plandowski,et al.  On the Complexity of Pattern Matching for Highly Compressed Two-Dimensional Texts , 2002, J. Comput. Syst. Sci..

[4]  Wojciech Rytter,et al.  A Constant Time Optimal Parallel Algorithm for Two-Dimensional Pattern Matching , 1998, SIAM J. Comput..

[5]  Theodore P. Baker A Technique for Extending Rapid Exact-Match String Matching to Arrays of More Than One Dimension , 1978, SIAM J. Comput..

[6]  Abraham Lempel,et al.  Compression of individual sequences via variable-rate coding , 1978, IEEE Trans. Inf. Theory.

[7]  Alejandro A. Schäffer,et al.  Multiple Matching of Rectangular Patterns , 1995, Inf. Comput..

[8]  Michael G. Main,et al.  An O(n log n) Algorithm for Finding All Repetitions in a String , 1984, J. Algorithms.

[9]  Gad M. Landau,et al.  Inplace 2D matching in compressed images , 2003, SODA '03.

[10]  Donald E. Knuth,et al.  Fast Pattern Matching in Strings , 1977, SIAM J. Comput..

[11]  M. Lothaire Applied Combinatorics on Words (Encyclopedia of Mathematics and its Applications) , 2005 .

[12]  M G W H Van De Rijdt,et al.  Two-dimensional Pattern Matching , 2005 .

[13]  Gad M. Landau,et al.  Inplace run-length 2d compressed search , 2000, SODA '00.

[14]  Ayumi Shinohara,et al.  Multiple pattern matching in LZW compressed text , 1998, Proceedings DCC '98 Data Compression Conference (Cat. No.98TB100225).