Arrow Research search
Back to TCS

TCS 2021

Fast algorithms for single and multiple pattern Cartesian tree matching

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

Abstract

Cartesian tree matching is the problem of finding every substring of a given text which has the same Cartesian tree as that of a given pattern. In this paper we propose fast algorithms for single and multiple pattern Cartesian tree matching by introducing new representations and encodings. For single pattern Cartesian tree matching, we present the framework of a binary filtration method and an efficient verification technique. Any exact string matching algorithm can be used as a filtration for Cartesian tree matching in our framework. For multiple pattern Cartesian tree matching, we present two fingerprinting methods, i. e. , the parent-distance encoding and the binary encoding. By combining an efficient fingerprinting method and a conventional multiple string matching algorithm, we can efficiently solve multiple pattern Cartesian tree matching. By experiments we show that our matching algorithms provide good performances for both single and multiple pattern Cartesian tree matching.

Authors

Keywords

  • Cartesian tree matching
  • Prefix-parent representation
  • Prefix-child representation
  • Global-parent representation
  • Fingerprinting methods

Context

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