Arrow Research search
Back to TCS

TCS 2025

Approximate Cartesian tree pattern matching

Journal Article journal-article Computer Science ยท Theoretical Computer Science

Abstract

The Cartesian tree of a string is a binary tree, which is useful in capturing minimalities within strings. We study the approximate pattern matching problem for two Cartesian trees of two strings. We design a polynomial-time algorithm that computes the minimum edit cost when a given string is edited to match the Cartesian tree of the other string. We also design a linear-time algorithm that computes the (max, min)-convolution between two sorted arrays, which we use to speed up the algorithm computing the edit cost. Then, we adapt the algorithm that computes the edit cost to the approximate pattern matching problem, where we find all substrings of a given text that match a given Cartesian tree pattern within a given number of edit operations. We also consider variant problems such as the approximate Cartesian matching under Hamming distance, and present polynomial-time algorithms for the considered problems.

Authors

Keywords

  • Cartesian trees
  • Approximate pattern matching
  • Edit distance

Context

Venue
Theoretical Computer Science
Archive span
1975-2026
Indexed papers
16261
Paper id
80719662951023100
v2026.09.13