## Abstract

Given ε∈[0,1), the ε-Relative Error Periodic Pattern Problem (REPP) is the following: INPUT: An n-long sequence S of numbers s _{i}∈N in increasing order. OUTPUT: The longest ε-relative error periodic pattern, i.e., the longest subsequence s_{i1}, s _{i2}, ⋯ s_{ik} of S, for which there exists a number p such that the absolute difference between any two consecutive numbers in the subsequence is at least p and at most p(1+ε). The best known algorithm for this problem has O(n^{3}) time complexity. This bound is too high for large inputs in practice. In this paper we give a new algorithm for finding the longest ε-relative error periodic pattern (the REPP problem). Our method is based on a transformation of the input sequence into a different representation: the ε-active maximal intervals list L, defined in this paper. We show that the transformation of S to the list L can be done efficiently (quadratic in n and linear in the size of L) and prove that our algorithm is linear in the size of L. This enables us to prove that our algorithm works in sub-cubic time on inputs for which the best known algorithm works in O(n^{3}) time. Moreover, though it may happen that our algorithm would still be cubic, it is never worse than the known O(n ^{3})-algorithm and in many situations its complexity is O(n ^{2}) time.

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

Pages (from-to) | 60-67 |

Number of pages | 8 |

Journal | Theoretical Computer Science |

Volume | 525 |

DOIs | |

State | Published - 13 Mar 2014 |

### Bibliographical note

Funding Information:The first author was partly supported by NSF grant CCR-09-04581, ISF grant 347/09, and BSF grant 2008217. The second author was partly supported by BSF grant 2008217. The fourth author was partly supported by the National Science Foundation Award 0904246, Israel Science Foundation grant 347/09, Yahoo, Grant No. 2008217 from the United States–Israel Binational Science Foundation (BSF) and DFG. The fifth author was partly supported by ISF grant 347/09.

## Keywords

- Approximate arithmetic progressions
- Approximate periodic patterns
- String analysis