arXiv · 1905.08974
Cartesian Tree Matching and Indexing
Abstract
We introduce a new metric of match, called Cartesian tree matching, which means that two strings match if they have the same Cartesian trees. Based on Cartesian tree matching, we define single pattern matching for a text of length n and a pattern of length m, and multiple pattern matching for a text of length n and k patterns of total length m. We present an O(n+m) time algorithm for single pattern matching, and an O((n+m) log k) deterministic time or O(n+m) randomized time algorithm for multiple pattern matching. We also define an index data structure called Cartesian suffix tree, and present an O(n) randomized time algorithm to build the Cartesian suffix tree. Our efficient algorithms for Cartesian tree matching use a representation of the Cartesian tree, called the parent-distance representation.
Explore related subjects
Keep this discovery
Sung Gwan Park, Amihood Amir, Gad M. Landau, Kunsoo Park. 2019-05-22. Cartesian Tree Matching and Indexing. https://arxiv.org/abs/1905.08974
Cite the original work for its findings. Save a collection to share your selection of sources.