arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2202.04349cs.DS
收藏

笛卡尔树子序列匹配

Cartesian Tree Subsequence Matching

Tsubasa Oizumi, Takeshi Kai, Takuya Mieno, Shunsuke Inenaga, Hiroki Arimura

摘要:

Park等人[TCS 2020]观察到两个(数值)字符串之间的相似性可以通过笛卡尔树来捕获:字符串的笛卡尔树是一棵二叉树,通过选择字符串的最小值作为树根递归构造。如果两个等长的字符串的笛卡尔树是同构的,则称它们为笛卡尔树匹配。Park等人[TCS 2020]介绍了以下笛卡尔树子串匹配(CTMStr)问题:给定长度为$n$的文本字符串$T$和长度为$m$的模式字符串,找到文本字符串$T$的每个连续子串$S = T[i..j]$,使得$S$和$P$笛卡尔树匹配。他们展示了如何在$\tilde{O}(n+m)$时间内解决这个问题。本文介绍了笛卡尔树子序列匹配(CTMSeq)问题,该问题要求找到$T$的每个最小子串$S = T[i..j]$,使得$S$包含一个子序列$S'$,该子序列是笛卡尔树与$P$匹配的.我们证明了CTMSeq问题可以有效地解决,在$O(m n p(n))$时间,其中$p(n)$表示动态前导查询的更新/查询时间。通过使用合适的动态前驱数据结构,我们获得了CTMSeq的$O(mn \log \log n)$ -时间和$O(n \log m)$ -空间解。这将CTMSeq与密切相关的保序子序列匹配(OPMSeq)进行了对比,Bose等人[IPL 1998]证明OPMSeq是NP难的。

英文摘要:

Park et al. [TCS 2020] observed that the similarity between two (numerical) strings can be captured by the Cartesian trees: The Cartesian tree of a string is a binary tree recursively constructed by picking up the smallest value of the string as the root of the tree. Two strings of equal length are said to Cartesian-tree match if their Cartesian trees are isomorphic. Park et al. [TCS 2020] introduced the following Cartesian tree substring matching (CTMStr) problem: Given a text string $T$ of length $n$ and a pattern string of length $m$, find every consecutive substring $S = T[i..j]$ of a text string $T$ such that $S$ and $P$ Cartesian-tree match. They showed how to solve this problem in $\tilde{O}(n+m)$ time. In this paper, we introduce the Cartesian tree subsequence matching (CTMSeq) problem, that asks to find every minimal substring $S = T[i..j]$ of $T$ such that $S$ contains a subsequence $S'$ which Cartesian-tree matches $P$. We prove that the CTMSeq problem can be solved efficiently, in $O(m n p(n))$ time, where $p(n)$ denotes the update/query time for dynamic predecessor queries. By using a suitable dynamic predecessor data structure, we obtain $O(mn \log \log n)$-time and $O(n \log m)$-space solution for CTMSeq. This contrasts CTMSeq with closely related order-preserving subsequence matching (OPMSeq) which was shown to be NP-hard by Bose et al. [IPL 1998].

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑