Skip to main navigation Skip to search Skip to main content

Approximate Cartesian tree matching with one difference

  • Bastien Auvray
  • , Julien David
  • , Samah Ghazawi
  • , Richard Groult
  • , Gad M. Landau
  • , Thierry Lecroq

Research output: Contribution to journal › Article › peer-review

Abstract

Cartesian tree pattern matching consists in finding all the factors of a text that have the same Cartesian tree as 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 finds all the factors of the text that have the same Cartesian tree as the pattern with one difference, using several notions of differences. We show that this algorithm has O(nm) worst-case time complexity and that, for several random models, the algorithm has a linear average-case complexity. We also present an automaton based algorithm, adapting [1], that can be generalized to deal with more than one difference.

Original languageEnglish
Article number116026
JournalTheoretical Computer Science
Volume1079
DOIs
StatePublished - 18 Jul 2026

Bibliographical note

Publisher Copyright:
© 2026 Elsevier B.V.

Keywords

  • Approximate pattern matching
  • Cartesian tree matching
  • Deletion
  • Insertion
  • Mismatch
  • Swap
  • Transposition

ASJC Scopus subject areas

  • Theoretical Computer Science
  • General Computer Science

Fingerprint

Dive into the research topics of 'Approximate Cartesian tree matching with one difference'. Together they form a unique fingerprint.

Cite this