Manuscript Offprint

arXiv:2611.26297

Exact guarantees and faster algorithms for kk-rollercoasters

Sungmin Kim, Florin Manea

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

For k≥3k\ge3, a kk-rollercoaster is a sequence of distinct values whose maximal increasing and decreasing runs all have length at least kk. We discover the maximum guaranteed length fk(n)f_k(n) of kk-rollercoasters appearing as subsequences of nn-point permutations. In particular, letting q=k−1q=k-1, we prove that fk(n)=⌈n/q⌉f_k(n)= \lceil n/q\rceil for n≥2q2n\ge2q^2, fk(n)=2q−⌊2q2−n⌋f_k(n)= 2q-\lfloor \sqrt{2q^2-n}\rfloor for q2<n<2q2q^2<n<2q^2 and fk(n)=0f_k(n)= 0 otherwise. We prove that the guarantees are tight by constructing an nn-point permutation whose longest kk-rollercoaster has exactly fk(n)f_k(n) points. Our proof extends Seidenberg's argument [Journal of the London Mathematical Society, 1959] for proving the Erdős--Szekeres theorem by representing points in a subsequence with respect to the lengths of longest monotonic (increasing and decreasing) subsequences that reach each point. The combinatorial proof yields a deterministic comparison-based algorithm that finds a rollercoaster of length at least fk(n)f_k(n) in O(nlog⁡fk(n))O(n\log f_k(n)) time and O(n)O(n) space for n>q2n>q^2. Independently, we give an O(nklog⁡k)O(nk\log k)-time, O(nk)O(nk)-space algorithm for a longest kk-rollercoaster, improving the previous O(nk2)O(nk^2) bound. We use the dynamic program of Gawrychowski et al. [STACS 2019, Algorithmica 2022], and process its weighted predecessor queries through monotone subsequences with finger-search trees. Both algorithms return such subsequences.

A PDF page turning into lines of clean text

Preparing the full text

It will appear here by itself. You can read the abstract meanwhile.