Position Heaps for Cartesian-tree Matching on Strings and Tries
Abstract
The Cartesian-tree pattern matching is a recently introduced scheme of pattern matching that detects fragments in a sequential data stream which have a similar structure as a query pattern. Formally, Cartesian-tree pattern matching seeks all substrings of the text string such that the Cartesian tree of and that of a query pattern coincide. In this paper, we present a new indexing structure for this problem called the Cartesian-tree Position Heap (CPH). Let be the length of the input text string , the length of a query pattern , and the alphabet size. We show that the CPH of , denoted , supports pattern matching queries in time with space, where is the height of the CPH and is the number of pattern occurrences. We show how to build in time with working space. Further, we extend the problem to the case where the text is a labeled tree (i.e. a trie). Given a trie with nodes, we show that the CPH of , denoted , supports pattern matching queries on the trie in time with space. We also show a construction algorithm for running in time and working space.
Cite
@article{arxiv.2106.01595,
title = {Position Heaps for Cartesian-tree Matching on Strings and Tries},
author = {Akio Nishimoto and Noriki Fujisato and Yuto Nakashima and Shunsuke Inenaga},
journal= {arXiv preprint arXiv:2106.01595},
year = {2021}
}