Two Linear Passes Are Necessary for Sum-Exclude-Self Under Sublinear Space

Abstract

We prove that any algorithm computing the sum-exclude-self of an unsigned d-bit integer array of length n under sublinear space must perform two linear passes over the input. More precisely, the algorithm must read at least n-1 input elements before any output cell receives its final value, and at least n - t/d additional elements thereafter, where t = o(nd) bits is the working memory size. This gives a total of 2n - 1 - t/d element reads. A trivial modification of the standard two-pass algorithm achieves this bound exactly for all practical input sizes. The proof uses this toy problem as a worked example to demonstrate the choke-point technique for proving sublinear-space lower bounds.

0

Turn this paper into a lesson

ArcXiv compiles a structured reading guide from this paper's metadata: plain-English importance, contributions, prerequisite concepts, which sections to read first, flashcards, and a quiz. Grounded in the abstract, never invented.

Discussion (0)

Sign in to join the discussion.

Loading comments…