Approximate Cartesian Tree Matching: an Approach Using Swaps
Bastien Auvray, Julien David, Richard Groult, Thierry Lecroq

TL;DR
This paper introduces the first algorithms for approximate Cartesian tree pattern matching allowing one swap, enabling efficient identification of similar pattern factors in texts with minimal modifications.
Contribution
It presents two novel algorithms for approximate Cartesian tree matching with one swap, a previously unaddressed problem in pattern matching.
Findings
First algorithm runs in Theta(mn) time with Theta(m) space.
Second algorithm runs in O((m^2 + n)log m) time with O(m^2) space.
Both algorithms effectively identify pattern matches after one swap.
Abstract
Cartesian tree pattern matching consists of finding all the factors of a text that have the same Cartesian tree than a given pattern. There already exist theoretical and practical solutions for the exact case. In this paper, we propose the first algorithm for solving approximate Cartesian tree pattern matching. We consider Cartesian tree pattern matching with one swap: given a pattern of length m and a text of length n we present two algorithms that find all the factors of the text that have the same Cartesian tree of the pattern after one transposition of two adjacent symbols. The first algorithm uses a characterization of a linear representation of the Cartesian trees called parent-distance after one swap and runs in time Theta(mn) using Theta(m) space. The second algorithm generates all the parent-distance tables of sequences that have the same Cartesian tree than the pattern after…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAlgorithms and Data Compression · Natural Language Processing Techniques · semigroups and automata theory
