Table of Contents
Fetching ...

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

Andrew Au

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 - \lfloor t/d \rfloor$ additional elements thereafter, where $t = o(nd)$ bits is the working memory size. This gives a total of $2n - 1 - \lfloor t/d \rfloor$ 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.

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 -bit integer array of length under sublinear space must perform two linear passes over the input. More precisely, the algorithm must read at least input elements before any output cell receives its final value, and at least additional elements thereafter, where bits is the working memory size. This gives a total of 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.

Paper Structure

This paper contains 12 sections, 3 theorems, 11 equations.

Key Result

Lemma 2.2

During the first pass, the algorithm must read at least $n-1$ elements of $\mathit{In}$. $\blacktriangleleft$$\blacktriangleleft$

Theorems & Definitions (10)

  • Definition 2.1
  • Lemma 2.2
  • proof
  • Remark 2.3
  • Definition 3.1
  • Lemma 3.2
  • proof
  • Theorem 3.3
  • proof
  • Remark 3.4