Abstract
A word of the form WW for some word (Formula presented.) is called a square. A partial word is a word possibly containing holes (also called don’t cares). The hole is a special symbol (Formula presented.) which matches any symbol from (Formula presented.). A p-square is a partial word matching at least one square WW without holes. Two p-squares are called equivalent if they match the same set of squares. A p-square is called here unambiguous if it matches exactly one square WW without holes. Such p-squares are natural counterparts of classical squares. Let (Formula presented.) and (Formula presented.) be the maximum number of non-equivalent p-squares and non-equivalent unambiguous p-squares in T over all partial words T of length n with at most k holes. We show asymptotically tight bounds: (Formula presented.)We present an algorithm that reports all non-equivalent p-squares in (Formula presented.) time for a partial word of length n with k holes, for an integer alphabet. In particular, it runs in linear time for (Formula presented.) and its time complexity near-matches the asymptotic bound for (Formula presented.). We also show an (Formula presented.)-time algorithm that reports all non-equivalent p-squares of a given length. The paper is a full and improved version of Charalampopoulos et al. (in Cao Y, Chen Y (eds) Proceedings of the 23rd international conference on computing and combinatorics, COCOON 2017; Springer, 2017).
Original language | English |
---|---|
Pages (from-to) | 1-22 |
Number of pages | 22 |
Journal | JOURNAL OF COMBINATORIAL OPTIMIZATION |
Early online date | 21 May 2018 |
DOIs | |
Publication status | E-pub ahead of print - 21 May 2018 |
Keywords
- Approximate period
- Lyndon word
- Partial word
- Square in a word