Andrew Au

2papers

2 Papers

23.3DSApr 26
A Tight Lower Bound for Cycle Detection in Grid Graphs

Andrew Au

We prove that any algorithm for detecting cycles in an $m \times n$ grid graph, where cells are colored and adjacency is defined by matching colors, must read all $mn$ cells in the worst case for all grids with $m \geq 2$ and $n \geq 2$. The proof is by adversary argument: we construct an adaptive adversary that maintains ambiguity -- one completion containing a cycle and one without -- until the final cell is read. The construction proceeds by tiling the grid with $2 \times 2$, $2 \times 3$, $3 \times 2$, and $3 \times 3$ blocks, each equipped with an independent block adversary, composed via a checkerboard isolation scheme.

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

Andrew Au

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.