English

Approximate Cartesian Tree Matching with One Difference

Data Structures and Algorithms 2025-05-15 v1

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.

Keywords

Cite

@article{arxiv.2505.09236,
  title  = {Approximate Cartesian Tree Matching with One Difference},
  author = {Bastien Auvray and Julien David and Samah Ghazawi and Richard Groult and Gad M. Landau and Thierry Lecroq},
  journal= {arXiv preprint arXiv:2505.09236},
  year   = {2025}
}

Comments

Submitted to Elsevier's Theoretical Computer Science (May 2025). arXiv admin note: text overlap with arXiv:2306.16065

R2 v1 2026-06-28T23:32:44.643Z