Tight Cell-Probe Bounds for Online Hamming Distance Computation

We show tight bounds for online Hamming distance computation in the cell-probe model with word size w. The task is to output the Hamming distance between a fixed string of length n and the last n symb

Tight Cell-Probe Bounds for Online Hamming Distance Computation

We show tight bounds for online Hamming distance computation in the cell-probe model with word size w. The task is to output the Hamming distance between a fixed string of length n and the last n symbols of a stream. We give a lower bound of Omega((d/w)*log n) time on average per output, where d is the number of bits needed to represent an input symbol. We argue that this bound is tight within the model. The lower bound holds under randomisation and amortisation.


💡 Research Summary

The paper investigates the fundamental time complexity of computing the Hamming distance between a fixed pattern of length n and the most recent n symbols of an incoming stream, within the cell‑probe model. In this model, computation cost is measured solely by memory accesses (cell probes), each of which reads or writes a word of w bits; the size of each input symbol is d bits. The authors establish a tight lower bound of Ω((d/w)·log n) cell‑probes per output on average, and they show that this bound is achievable, yielding a matching upper bound of Θ((d/w)·log n). Consequently, the exact asymptotic cost of the online Hamming‑distance problem is determined for this model.

The lower‑bound proof relies on the information‑transfer technique. The authors construct a hard distribution over input streams such that, for each time step t≥n, the information needed to compute the Hamming distance must convey at least d·log n bits from the past to the present. Because a single word can carry at most w bits, any algorithm—deterministic or randomized—must perform at least (d·log n)/w cell‑probes in expectation for that step. By carefully partitioning the execution into intervals and showing that the information transferred across interval boundaries is essentially independent, they extend the per‑step bound to an amortized bound of Ω((d/w)·log n) per output over the whole execution. The argument holds under randomisation (i.e., for Monte‑Carlo algorithms) and under amortisation, meaning that even if occasional steps are cheap, the average cannot drop below the stated bound.

For the upper bound, the paper adapts known bit‑packing strategies to the online setting. The fixed pattern P is packed into ⌈d·n/w⌉ words, each containing multiple symbols. As each new stream symbol arrives, the algorithm updates a sliding window representation of the last n symbols, also packed into words. A word‑wise XOR between the packed pattern and the packed window yields a word whose set bits correspond to mismatches. A POPCOUNT operation (counting 1‑bits) on each word gives the contribution to the Hamming distance. Because each word processes w/d symbols, the basic update costs O(d/w) cell‑probes. To handle the sliding window efficiently, the algorithm maintains auxiliary structures that allow the window to be shifted in O(log n) word operations, leading to an overall per‑output cost of Θ((d/w)·log n) cell‑probes. This algorithm is deterministic, works in the worst case, and matches the lower bound without any hidden polylogarithmic factors.

The tightness of the bound has several implications. First, it shows that any improvement in online Hamming‑distance computation must come from hardware changes (e.g., increasing w) rather than algorithmic tricks, as the bound scales linearly with d/w. Second, the result applies to a broad class of streaming applications—real‑time error detection, network traffic monitoring, and online pattern matching—where the Hamming distance is a core primitive. Third, the methodology demonstrates how the information‑transfer framework can be extended to problems where the output depends on a sliding window of the input, suggesting a pathway for proving tight bounds for other online string‑processing tasks such as convolution or edit distance.

In summary, the paper delivers a complete characterization of the online Hamming‑distance problem in the cell‑probe model: a lower bound of Ω((d/w)·log n) that holds for randomized and amortized algorithms, and a matching deterministic upper bound of Θ((d/w)·log n). This resolves the complexity of the problem up to constant factors and provides a benchmark for future research on streaming string algorithms.


📜 Original Paper Content

🚀 Synchronizing high-quality layout from 1TB storage...