0
9.6kviews
Suppose a stream consists of the integers 2,1,6,1,5,9,2,3,5.

Let the hash functions all be of the from h(x)=ax+b mod 16 for some a & b. You should treat the results as a 4 bit binary integer. Determine the tail length for each stream element and the resulting estimate of the number of distinct elements if the hash function is: a) h(x) = 2x+3 mod 16 b) h(x) = 4x+1 mod 16 c) 5x mod 16

1 Answer
0
836views

S = { 2, 1, 6, 1, 5, 9, 2, 3, 5 } |b| = 2

(a) h(x) = 2x + 3 mod 16

S r binary r(a)
2 7 0111 0
1 5 0101 0
6 15 1111 0
1 5 0101 0
5 13 1101 0
9 5 0101 0
2 7 0111 0
3 9 1001 0
5 13 1101 0

No of distinct elements = $2^max[r(a)] = 2^0 = 1$

(b) h(x) = 4x + 1 mod 16

S r binary r(a)
2 9 1001 0
1 5 0101 0
6 9 1001 0
1 5 0101 0
5 5 0101 0
9 5 0101 0
2 9 1001 0
3 13 1101 0
5 5 0101 0

No of distinct elements = $2^max(r(a))$

$= 2^0 = 1$

( c ) 5x mod 16

S r binary r(a)
2 10 1010 1
1 5 0101 0
6 14 1110 1
1 5 0101 0
5 9 1001 0
9 13 1101 1
2 10 1010 1
3 15 1111 0
5 9 1001 0

No of distinct elements = $2^max(r(a))$

$= 2^1 = 2$

Please log in to add an answer.