arXiv:2611.24768cs.DSNov 2026

Manuscript Offprint

arXiv:2611.24768

Small-Space Streaming Hamming Approximation

Przemyslaw Uznanski

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

For relative-ε\varepsilon Hamming matching with a preprocessed length-mm pattern and a streaming text, we give space bounds

ε−8/5m2/5+o(1),ε−1m1/2+o(1)words.\varepsilon^{-8/5}m^{2/5+o(1)},\qquad\varepsilon^{-1}m^{1/2+o(1)}\quad\text{words}.

All retained pattern information counts toward space, and answers are immediate and simultaneously correct with high probability. The prior space bounds are O~(ε−3/2m)\widetilde{O}(\varepsilon^{-3/2}\sqrt{m}) and O~((m/ε)2/3)\widetilde{O}((m/\varepsilon)^{2/3}), the latter an unpublished consequence of earlier work [CGK+20, CKP18]. For ε=Θ(m−a)\varepsilon=\Theta(m^{-a}), our better bound improves on both leading space exponents for every fixed 0<a<1/20<a<1/2.

A Fourier matcher uses O~(ε−2(m/K)2)\widetilde{O}(\varepsilon^{-2}(m/K)^{2}) words to estimate each distance dd within ε(d+K)\varepsilon(d+K), giving relative error at most 2ε2\varepsilon for d≥Kd\geq K. A threshold matcher based on random-prime residue refinements and multi-stream dictionary matching [GKP18] gives the second bound directly and the first when combined with the Fourier matcher. Both space bounds extend to L1L_{1} matching over polynomially bounded integer symbols.

1 Introduction and results

Given a pattern P∈ΣmP\in\Sigma^{m} and a text T∈ΣnT\in\Sigma^{n}, the text-to-pattern Hamming distances are

ds=Ham⁡(P,T[s:s+m])=∣{j∈[0,m):P[j]≠T[s+j]}∣,0≤s≤n−m.d_{s}=\operatorname{Ham}(P,T[s:s+m])=|\{j\in[0,m):P[j]\neq T[s+j]\}|,\qquad 0\leq s\leq n-m.

Indices are zero-based, and T[a:b]=T[a]⋯T[b−1]T[a:b]=T[a]\cdots T[b-1] denotes a half-open substring. Intervals used as index sets contain only integers. In the streaming setting, the answer for ss must be reported when T[s+m−1]T[s+m-1] arrives. A relative-ε\varepsilon estimate d^s\widehat{d}_{s} satisfies ∣d^s−ds∣≤εds|\widehat{d}_{s}-d_{s}|\leq\varepsilon d_{s}; in particular, zero distances must be reported exactly.