Finding patterns and periods in Cartesian tree matching

Autor: Sung Gwan Park, Magsarjav Bataa, Amihood Amir, Gad M. Landau, Kunsoo Park
Rok vydání: 2020
Předmět:
Zdroj: Theoretical Computer Science. 845:181-197
ISSN: 0304-3975
DOI: 10.1016/j.tcs.2020.09.014
Popis: We introduce a new metric of match, called Cartesian tree matching, which means that two strings match if they have the same Cartesian trees. Based on Cartesian tree matching, we define single pattern matching, multiple pattern matching, and indexing problems. We propose a linear time algorithm for single pattern matching, and randomized linear time algorithms for multiple pattern matching and indexing. We also define three types of periods, called full period, initial period, and general period. We propose O ( n ) time, O ( n log ⁡ log ⁡ n ) time, and O ( n log ⁡ n ) time algorithms for finding all the full periods, initial periods, and general periods of a string of length n, respectively. Our efficient algorithms use a representation of the Cartesian tree, called parent-distance representation.
Databáze: OpenAIRE