We study the distinct elements and $\ell_p$-heavy hitters problems in the sliding window model, where only the most recent $n$ elements in the data stream form the underlying set. We first introduce the composable histogram, a simple twist on the exponential (Datar et al., SODA 2002) and smooth histograms (Braverman and Ostrovsky, FOCS 2007) that may be of independent interest. We then show that the composable histogram along with a careful combination of existing techniques to track either the identity or frequency of a few specific items suffices to obtain algorithms for both distinct elements and $\ell_p$-heavy hitters that are nearly optimal in both $n$ and $\epsilon$. Applying our new composable histogram framework, we provide an algorithm that outputs a $(1+\epsilon)$-approximation to the number of distinct elements in the sliding window model and uses $\mathcal{O}\left(\frac{1}{\epsilon^2}\log n\log\frac{1}{\epsilon}\log\log n+\frac{1}{\epsilon}\log^2 n\right)$ bits of space. For $\ell_p$-heavy hitters, we provide an algorithm using space $\mathcal{O}\left(\frac{1}{\epsilon^p}\log^3 n\left(\log\log n+\log\frac{1}{\epsilon}\right)\right)$ for $0<p\le 2$, improving upon the best-known algorithm for $\ell_2$-heavy hitters (Braverman et al., COCOON 2014), which has space complexity $\mathcal{O}\left(\frac{1}{\epsilon^4}\log^3 n\right)$. We also show lower bounds of $\Omega\left(\frac{1}{\epsilon}\log^2 n+\frac{1}{\epsilon^2}\log n\right)$ for distinct elements and $\Omega\left(\frac{1}{\epsilon^p}\log^2 n\right)$ for $\ell_p$-heavy hitters.
翻译:我们研究滑动窗口模型下的不同元素和 $\ell_p$-重要元素问题,其中仅最近的 $n$ 个元素形成底层集合。我们首先引入了可组合的直方图,这是指数直方图(Datar等,SODA 2002)和平滑直方图(Braverman和Ostrovsky,FOCS 2007)的一种简单扭曲,可能是非常重要的。然后,我们展示了可组合的直方图和现有技术的谨慎结合,以跟踪几个特定项的标识或频率,足以获得几乎最优的不同元素和 $\ell_p$-重要元素算法,在 $n$ 和 $\epsilon$ 两个方面都是。应用新的可组合直方图框架,我们提出了一种算法,用于在滑动窗口模型中输出 $(1+\epsilon)$-逼近不同元素数量,并使用 $\mathcal{O} \left(\frac{1}{\epsilon^2}\log n\log \frac{1}{\epsilon}\log \log n+\frac{1}{\epsilon}\log^2 n\right)$ 位空间。对于 $\ell_p$-重要元素,我们提供了一种算法,使用空间 $\mathcal{O}\left(\frac{1}{\epsilon^p}\log^3 n\left(\log \log n+\log \frac{1}{\epsilon}\right)\right)$,其中 $0<p\leq 2$,此算法优于$\ell_2$-重要元素的最佳已知算法(Braverman等,COCOON 2014),其空间复杂度为 $\mathcal{O}\left(\frac{1}{\epsilon^4}\log^3 n\right)$。我们还显示了不同元素的 $\Omega\left(\frac{1}{\epsilon}\log^2 n+\frac{1}{\epsilon^2}\log n\right)$ 的下限和 $\ell_p$-重要元素的 $\Omega\left(\frac{1}{\epsilon^p}\log^2 n\right)$ 的下限。