Computing Covers of 2D-Strings

We consider two notions of covers of a two-dimensional string T . A (rectangular) subarray P of T is a 2D-cover of T if each position of T is in an occurrence of P in T . A one-dimensional string S is a 1D-cover of T if its vertical and horizontal occurrences in T cover all positions of T . We show how to compute the smallest-area 2D-cover of an m × n array T in the optimal O(N) time, where N = mn, all aperiodic 2D-covers of T in O(N log N) time, and all 2D-covers of T in N4/3 · logO(1) N time. Further, we show how to compute all 1D-covers in the optimal O(N) time. Along the way, we show that the Klee’s measure of a set of rectangles, each of width and height at least √ n, on an n × n grid can be maintained in √ n · logO(1) n time per insertion or deletion of a rectangle, a result which could be of independent interest. 2012 ACM Subject Classification Theory of computation → Pattern matching

[1]  Jon Louis Bentley,et al.  Multidimensional divide-and-conquer , 1980, CACM.

[2]  H. Wilf,et al.  Uniqueness theorems for periodic functions , 1965 .

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

[4]  Costas S. Iliopoulos,et al.  Optimal Superprimitivity Testing for Strings , 1991, Inf. Process. Lett..

[5]  Timothy M. Chan Klee's Measure Problem Made Easy , 2013, 2013 IEEE 54th Annual Symposium on Foundations of Computer Science.

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

[7]  Dany Breslauer,et al.  An On-Line String Superprimitivity Test , 1992, Inf. Process. Lett..

[8]  William F. Smyth,et al.  An Optimal Algorithm to Compute all the Covers of a String , 1994, Inf. Process. Lett..

[9]  William F. Smyth,et al.  A Correction to "An Optimal Algorithm to Compute all the Covers of a String" , 1995, Inf. Process. Lett..

[10]  Maxime Crochemore,et al.  Two-Dimensional Prefix String Matching and Covering on Square Matrices , 1998, Algorithmica.

[11]  Alexandru Popa,et al.  An output-sensitive algorithm for the minimization of 2-dimensional String Covers , 2018, TAMC.

[12]  Wojciech Rytter,et al.  Internal Pattern Matching Queries in a Text and Applications , 2013, SODA.

[13]  Maxime Crochemore,et al.  Quasiperiodicities in Fibonacci strings , 2012, Ars Comb..

[14]  Wojciech Rytter,et al.  The Number of Repetitions in 2D-Strings , 2020, ESA.

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

[16]  Mark H. Overmars,et al.  New upper bounds in Klee's measure problem , 1988, [Proceedings 1988] 29th Annual Symposium on Foundations of Computer Science.

[17]  Amihood Amir,et al.  Multidimensional Period Recovery , 2020, SPIRE.