Approximate Cartesian Tree Matching with One Difference

📅 2025-05-14
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This paper studies Approximate Cartesian Tree Matching: finding all substrings of length $m$ in a text of length $n$ whose Cartesian trees differ from the pattern’s Cartesian tree in at most one structural aspect—e.g., a parent-child relationship or extremum position. We propose the first efficient algorithm supporting single-structural-difference matching, introducing a unified framework compatible with multiple definitions of structural difference. Our approach leverages a finite automaton-based design, ensuring extensibility to multi-difference settings. Theoretical analysis shows average-case linear time complexity under several stochastic models (e.g., random permutations, i.i.d. sequences), while worst-case runtime is $O(nm)$. The algorithm balances theoretical soundness with practical efficiency, establishing a new paradigm for robust structural matching of Cartesian trees.

Technology Category

Application Category

📝 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 algorithms for solving approximate Cartesian tree pattern matching with one difference given a pattern of length m and a text of length n. We present a generic algorithm that find all the factors of the text that have the same Cartesian tree of the pattern with one difference, using different notions of differences. We show that this algorithm has a O(nM) worst-case complexity and that, for several random models, the algorithm has a linear average-case complexity. We also present an automaton based algorithm, adapting [PALP19], that can be generalized to deal with more than one difference.
Problem

Research questions and friction points this paper is trying to address.

Solve approximate Cartesian tree matching with one difference
Develop algorithms for pattern-text Cartesian tree comparison
Analyze worst-case and average-case complexity of solutions
Innovation

Methods, ideas, or system contributions that make the work stand out.

Algorithm for approximate Cartesian tree matching
Worst-case complexity O(nM), linear average-case
Automaton-based algorithm for multiple differences
🔎 Similar Papers
No similar papers found.
B
Bastien Auvray
Univ Rouen Normandie, INSA Rouen Normandie, Université Le Havre Normandie, Normandie Univ, LITIS UR 4108, Rouen, 76000, France
J
Julien David
Normandie University, UNICAEN, ENSICAEN, CNRS, GREYC, Caen, France
S
Samah Ghazawi
Department of Software Engineering, Braude, College of Engineering, Karmiel, Israel
R
Richard Groult
Univ Rouen Normandie, INSA Rouen Normandie, Université Le Havre Normandie, Normandie Univ, LITIS UR 4108, Rouen, 76000, France
G
Gad M. Landau
Department of Computer Science, University of Haifa, Haifa, Israel; Department of Computer Science and Engineering, NYU Tandon, New York, USA
Thierry Lecroq
Thierry Lecroq
LITIS UR 4108, University of Rouen Normandy, France
Computer ScienceBioinformaticsAlgorithms on strings