An Optimal Algorithm for the Distinct Elements Problem
Open/View files
Date
2010
Author(s)
Kane, Daniel M.
Woodruff, David P.
Publisher
ACM
The Harvard community has made this article openly available. Please share how this access benefits you.
Citation
Kane, Daniel M., Jelani Nelson, and David P. Woodruff. 2010. "An Optimal Algorithm for the Distinct Elements Problem." In Proceedings of the Twenty-Ninth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems of Data: PODS '10, June 6-11, 2010, Indianapolis, Indiana: 41-52. New York, NY: ACM.
Abstract
We give the first optimal algorithm for estimating the number of distinct elements in a data stream, closing a long line of theoretical research on this problem begun by Flajolet and Martin in their seminal paper in FOCS 1983. This problem has applications to query optimization, Internet routing, network topology, and data mining. For a stream of indices in {1,...,n}, our algorithm computes a \((1 \pm \epsilon)\)-approximation using an optimal \(O(1/\epsilon^{-2} + log(n))\) bits of space with 2/3 success probability, where \(0<\epsilon<1\) is given. This probability can be amplified by independent repetition. Furthermore, our algorithm processes each stream update in O(1) worst-case time, and can report an estimate at any point midstream in O(1) worst-case time, thus settling both the space and time complexities simultaneously. We also give an algorithm to estimate the Hamming norm of a stream, a generalization of the number of distinct elements, which is useful in data cleaning, packet tracing, and database auditing. Our algorithm uses nearly optimal space, and has optimal O(1) update and reporting times.
Terms of Use
This article is made available under the terms and conditions applicable to Other Posted Material (LAA), as set forth at Terms of Service
Collection