English

Optimal bounds for approximate counting

Data Structures and Algorithms 2022-04-01 v2 Discrete Mathematics

Abstract

Storing a counter incremented NN times would naively consume O(logN)O(\log N) bits of memory. In 1978 Morris described the very first streaming algorithm: the "Morris Counter". His algorithm's space bound is a random variable, and it has been shown to be O(loglogN+log(1/ε)+log(1/δ))O(\log\log N + \log(1/\varepsilon) + \log(1/\delta)) bits in expectation to provide a (1+ε)(1+\varepsilon)-approximation with probability 1δ1-\delta to the counter's value. We provide a new simple algorithm with a simple analysis showing that randomized space O(loglogN+log(1/ε)+loglog(1/δ))O(\log\log N + \log(1/\varepsilon) + \log\log(1/\delta)) bits suffice for the same task, i.e. an exponentially improved dependence on the inverse failure probability. We then provide a new analysis showing that the original Morris Counter itself, after a minor but necessary tweak, actually also enjoys this same improved upper bound. Lastly, we prove a new lower bound for this task showing optimality of our upper bound. We thus completely resolve the asymptotic space complexity of approximate counting. Furthermore all our constants are explicit, and our lower bound and tightest upper bound differ by a multiplicative factor of at most 3+o(1)3+o(1).

Keywords

Cite

@article{arxiv.2010.02116,
  title  = {Optimal bounds for approximate counting},
  author = {Jelani Nelson and Huacheng Yu},
  journal= {arXiv preprint arXiv:2010.02116},
  year   = {2022}
}

Comments

v2: incorporated PODS 2022 reviewer comments to improve presentation

R2 v1 2026-06-23T19:03:04.923Z