eng
Schloss Dagstuhl – Leibniz-Zentrum für Informatik
Leibniz International Proceedings in Informatics
1868-8969
2022-06-22
14:1
14:18
10.4230/LIPIcs.CPM.2022.14
article
Cartesian Tree Subsequence Matching
Oizumi, Tsubasa
1
Kai, Takeshi
1
Mieno, Takuya
2
https://orcid.org/0000-0003-2922-9434
Inenaga, Shunsuke
3
4
https://orcid.org/0000-0002-1833-010X
Arimura, Hiroki
2
https://orcid.org/0000-0002-2701-0271
Graduate School of Information Science and Technology, Hokkaido University, Sapporo, Japan
Faculty of Information Science and Technology, Hokkaido University, Sapporo, Japan
Department of Informatics, Kyushu University, Fukuoka, Japan
RESTO, Japan Science and Technology Agency, Kawaguchi, Japan
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 Õ(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].
https://drops.dagstuhl.de/storage/00lipics/lipics-vol223-cpm2022/LIPIcs.CPM.2022.14/LIPIcs.CPM.2022.14.pdf
string algorithms
pattern matching
Cartesian tree subsequence matching
order preserving matching
episode matching