Linear time computation of the maximal linear and circular sums of multiple independent insertions into a sequence

From MaRDI portal
Publication:501652

DOI10.1016/J.TCS.2016.11.005zbMATH Open1356.68300arXiv1307.1447OpenAlexW2262952408MaRDI QIDQ501652FDOQ501652

Ricardo C. Corrêa, Pablo M. S. Farias

Publication date: 9 January 2017

Published in: Theoretical Computer Science (Search for Journal in Brave)

Abstract: The maximal sum of a sequence "A" of "n" real numbers is the greatest sum of all elements of any strictly contiguous and possibly empty subsequence of "A", and it can be computed in "O(n)" time by means of Kadane's algorithm. Letting "A^(x -> p)" denote the sequence which results from inserting a real number "x" between elements "A[p-1]" and "A[p]", we show how the maximal sum of "A^(x -> p)" can be computed in "O(1)" worst-case time for any given "x" and "p", provided that an "O(n)" time preprocessing step has already been executed on "A". In particular, this implies that, given "m" pairs "(x_0, p_0), ..., (x_{m-1}, p_{m-1})", we can compute the maximal sums of sequences "A^(x_0 -> p_0), ..., A^(x_{m-1} -> p_{m-1})" in "O(n+m)" time, which matches the lower bound imposed by the problem input size, and also improves on the straightforward strategy of applying Kadane's algorithm to each sequence "A^(x_i -> p_i)", which takes a total of "Theta(n.m)" time. Our main contribution, however, is to obtain the same time bound for the more complicated problem of computing the greatest sum of all elements of any strictly or circularly contiguous and possibly empty subsequence of "A^(x -> p)". Our algorithms are easy to implement in practice, and they were motivated by and find application in a buffer minimization problem on wireless mesh networks.


Full work available at URL: https://arxiv.org/abs/1307.1447




Recommendations




Cites Work


Cited In (2)





This page was built for publication: Linear time computation of the maximal linear and circular sums of multiple independent insertions into a sequence

Report a bug (only for logged in users!)Click here to report a bug for this page (MaRDI item Q501652)