Rollercoasters with Plateaus
Abstract
In this paper we investigate the problem of detecting, counting, and enumerating (generating) all maximum length plateau--rollercoasters appearing as a subsequence of some given word (sequence, string), while allowing for plateaus. We define a plateau--rollercoaster as a word consisting of an alternating sequence of (weakly) increasing and decreasing \emph{runs}, with each run containing at least \emph{distinct} elements, allowing the run to contain multiple copies of the same symbol consecutively. This differs from previous work, where runs within rollercoasters have been defined only as sequences of distinct values. Here, we are concerned with rollercoasters of \emph{maximum} length embedded in a given word , that is, the longest rollercoasters that are a subsequence of . We present algorithms allowing us to determine the longest plateau--roller\-coasters appearing as a subsequence in any given word of length over an alphabet of size in time, to count the number of plateau--rollercoasters in of maximum length in time, and to output all of them with delay after preprocessing. Furthermore, we present an algorithm to determine the longest common plateau--rollercoaster within a set of words in where is the product of all word lengths within the set.
Keywords
Cite
@article{arxiv.2407.18620,
title = {Rollercoasters with Plateaus},
author = {Duncan Adamson and Pamela Fleischmann and Annika Huch},
journal= {arXiv preprint arXiv:2407.18620},
year = {2024}
}