| | |
Summary: The space complexity of approximating the frequency moments
Noga Alon
Yossi Matias
Mario Szegedy §
February 22, 2002
Abstract
The frequency moments of a sequence containing mi elements of type i, for 1 i n, are
the numbers Fk =
n
i=1 mk
i . We consider the space complexity of randomized algorithms that
approximate the numbers Fk, when the elements of the sequence are given one by one and cannot
be stored. Surprisingly, it turns out that the numbers F0, F1 and F2 can be approximated in
logarithmic space, whereas the approximation of Fk for k 6 requires n(1)
space. Applications
to data bases are mentioned as well.
1 Introduction
Let A = (a1, a2, . . . , am) be a sequence of elements, where each ai is a member of N = {1, 2, . . . , n}.
Let mi = |{j : aj = i}| denote the number of occurrences of i in the sequence A, and define, for each
k 0
|