A string UU for a non-empty string U is called a square. Squares have been well-studied both from a combinatorial and an algorithmic perspective. In this paper, we are the first to consider the problem of maintaining a representation of the squares in a dynamic string S of length at most n. We present an algorithm that updates this representation in no(1) time. This representation allows us to report a longest square-substring of S in O(1) time and all square-substrings of S in O(output) time. We achieve this by introducing a novel tool – maintaining prefix-suffix matches of two dynamic strings. We extend the above result to address the problem of maintaining a representation of all runs (maximal repetitions) of the string. Runs are known to capture the periodic structure of a string, and, as an application, we show that our representation of runs allows us to efficiently answer periodicity queries for substrings of a dynamic string. These queries have proven useful in static pattern matching problems and our techniques have the potential of offering solutions to these problems in a dynamic text setting.
|Title of host publication||27th Annual European Symposium on Algorithms, ESA 2019|
|Editors||Michael A. Bender, Ola Svensson, Grzegorz Herman|
|Publisher||Schloss Dagstuhl- Leibniz-Zentrum fur Informatik GmbH, Dagstuhl Publishing|
|State||Published - Sep 2019|
|Event||27th Annual European Symposium on Algorithms, ESA 2019 - Munich/Garching, Germany|
Duration: 9 Sep 2019 → 11 Sep 2019
|Name||Leibniz International Proceedings in Informatics, LIPIcs|
|Conference||27th Annual European Symposium on Algorithms, ESA 2019|
|Period||9/09/19 → 11/09/19|
Bibliographical noteFunding Information:
Funding Amihood Amir: Supported by Israel Science Foundation (ISF) grant 1475/18 and United States – Israel Binational Science Foundation (BSF) grant 2018141. Panagiotis Charalampopoulos: Partially supported by Israel Science Foundation (ISF) grant 794/13.
© Amihood Amir, Itai Boneh, Panagiotis Charalampopoulos, and Eitan Kondratovsky.
- Dynamic algorithms
- String algorithms