# A question about Flajolet-Martin algorithm

I am reading this algorithm in these notes for counting the number of distinct items in a stream.

From my understanding, the basic idea is that if such number is big enough, the distance between the numbers generated by the hash function will be, on average, the same and equal to $1/(k+1)$, where $k$ is the number of distinct element. Hence, one can derive $k$ from that. However, I don't follow the reasoning in slide 6. Why would $2^R$ be "around" $m$?

-

## 1 Answer

In words, I'd say the two preceding lines in the slide say "for a value $v$ much larger than $m$, it is very unlikely that $2^R$ will exceed $v$" respectively "for a value $v$ much smaller than $m$, it is very likely that $2^R$ will exceed $v$" (take $v=2^r$ both times). It does not seem an enormous strecth to conclude that most of the time $2^R$ will not be much larger than $m$ (first clause) but not much smaller than $m$ either (second clause), in other words, fairly close to $m$.

-
what if one recorded the minimum value seen so far? if the number of distinct items is sufficiently large, the distance between different elements (after hashing) will be uniform. hence, the length of the interval (all ones word) divided by the minimum should provide an estimate of the number of different items. does that make sense? –  ACAC Sep 25 '12 at 3:00