Theoretical Computer Science ( IF 0.9 ) Pub Date : 2020-09-11 , DOI: 10.1016/j.tcs.2020.09.014 Sung Gwan Park , Magsarjav Bataa , Amihood Amir , Gad M. Landau , Kunsoo Park
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 time, time, and 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.
中文翻译:
在笛卡尔树匹配中查找模式和周期
我们引入了一种新的匹配指标,称为笛卡尔树匹配,这意味着如果两个字符串具有相同的笛卡尔树,则它们匹配。基于笛卡尔树匹配,我们定义了单个模式匹配,多个模式匹配和索引问题。我们提出了用于单个模式匹配的线性时间算法,以及用于多个模式匹配和索引的随机线性时间算法。我们还定义了三种类型的时期,分别称为完整时期,初始时期和一般时期。我们建议 时间, 时间和 时间算法,分别查找长度为n的字符串的所有完整周期,初始周期和一般周期。我们高效的算法使用笛卡尔树的表示形式,称为父距离表示。