,
Dominik Köppl
Creative Commons Attribution 4.0 International license
Given an array of n real numbers, the maximum segment sum (MSS) problem is to find a contiguous subarray that has the largest sum. While the MSS problem can be solved optimally with Kadane’s algorithm in O(n) time, the study of its indexing version spawned new extensions such as (a) retrieving the MSS after subtracting a query offset parameter for all array entries or (b) retrieving the MSS for arbitrary query ranges. We here study the combination of both problems (a) and (b), which requires retrieving the MSS for arbitrary query ranges after subtracting a query offset parameter for all array entries. For that, we present an index whose query time is only slower than the best known for (a) by a factor of O(log n). In detail, our index uses O(n log n) space, supports queries in O(log² n) time, and can be constructed in O(n log³ n) time. As side results, we study our combined problem in the context of run-length compressed input, and also deduce a solution for (a) that works in run-length compressed space and time. Finally we give supportive lower bounds for our query problem, showing that there is only a polylogarithmic gap of improvement left.
@InProceedings{jo_et_al:LIPIcs.SWAT.2026.23,
author = {Jo, Seungbum and K\"{o}ppl, Dominik},
title = {{Indexing Range Maximum-Sum Segment Queries with Offsets}},
booktitle = {20th Scandinavian Symposium on Algorithm Theory (SWAT 2026)},
pages = {23:1--23:16},
series = {Leibniz International Proceedings in Informatics (LIPIcs)},
ISBN = {978-3-95977-421-5},
ISSN = {1868-8969},
year = {2026},
volume = {370},
editor = {Fraigniaud, Pierre},
publisher = {Schloss Dagstuhl -- Leibniz-Zentrum f{\"u}r Informatik},
address = {Dagstuhl, Germany},
URL = {https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.SWAT.2026.23},
URN = {urn:nbn:de:0030-drops-260597},
doi = {10.4230/LIPIcs.SWAT.2026.23},
annote = {Keywords: maximum segment sum, data structure, range query}
}