### Abstract

We address the problems of detecting and counting various forms of regularities in a string represented as a straight-line program (SLP) which is essentially a context free grammar in the Chomsky normal form. Given an SLP of size n that represents a string s of length N, our algorithm computes all runs and squares in s in O(n^{3}h) time and O(n^{2}) space, where h is the height of the derivation tree of the SLP. We also show an algorithm to compute all gapped-palindromes in O(n^{3}h + gnh log N) time and O(n^{2}) space, where g is the length of the gap. As one of the main components of the above solution, we propose a new technique called approximate doubling which seems to be a useful tool for a wide range of algorithms on SLPs. Indeed, we show that the technique can be used to compute the periods and covers of the string in O(n^{2}h) time and O(nh(n + log^{2} N)) time, respectively.

Original language | English |
---|---|

Pages (from-to) | 74-89 |

Number of pages | 16 |

Journal | Information and Computation |

Volume | 240 |

DOIs | |

Publication status | Published - 2015 Feb 1 |

### Keywords

- Compressed string processing algorithms
- Gapped palindromes
- Runs
- Squares
- Straight-line programs (SLPs)

### ASJC Scopus subject areas

- Theoretical Computer Science
- Information Systems
- Computer Science Applications
- Computational Theory and Mathematics

## Fingerprint Dive into the research topics of 'Detecting regularities on grammar-compressed strings'. Together they form a unique fingerprint.

## Cite this

*Information and Computation*,

*240*, 74-89. https://doi.org/10.1016/j.ic.2014.09.009