Given a data stream $\mathcal{A} = \langle a_1, a_2, \ldots, a_m \rangle$ of $m$ elements where each $a_i \in [n]$, the Distinct Elements problem is to estimate the number of distinct elements in $\mathcal{A}$.Distinct Elements has been a subject of theoretical and empirical investigations over the past four decades resulting in space optimal algorithms for it.All the current state-of-the-art algorithms are, however, beyond the reach of an undergraduate textbook owing to their reliance on the usage of notions such as pairwise independence and universal hash functions. We present a simple, intuitive, sampling-based space-efficient algorithm whose description and the proof are accessible to undergraduates with the knowledge of basic probability theory.
翻译:给定一个数据流 $\mathcal{A} = \langle a_1, a_2, \ldots, a_m \rangle$,其中包含 $m$ 个元素且每个 $a_i \in [n]$,不同元素问题旨在估计 $\mathcal{A}$ 中不同元素的数量。过去四十年间,不同元素问题一直是理论与实证研究的主题,并由此产生了空间最优的算法。然而,当前所有最先进的算法由于依赖成对独立性和通用哈希函数等概念,超出了本科教材的覆盖范围。我们提出了一种简单、直观且基于采样的空间高效算法,其描述与证明仅需掌握基础概率论知识的本科生即可理解。