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.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call