08.10.2016 Views

Foundations of Data Science

2dLYwbK

2dLYwbK

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Exercise 7.8 DELETE? THIS IS IN CURRENT DEFINITION<br />

Show that for a 2-universal hash family Prob (h(x) = z) = 1 for all x ∈ {1, 2, . . . , m}<br />

M+1<br />

and z ∈ {0, 1, 2, . . . , M}.<br />

Exercise 7.9 Let p be a prime. A set <strong>of</strong> hash functions<br />

H = {h| {0, 1, . . . , p − 1} → {0, 1, . . . , p − 1}}<br />

is 3-universal if for all u,v,w,x,y, and z in {0, 1, . . . , p − 1} , u, v, and w distinct<br />

Prob (h(x) = u) = 1 p , and<br />

Prob (h (x) = u, h (y) = v, h (z) = w) = 1 p 3 .<br />

(a) Is the set {h ab (x) = ax + b mod p | 0 ≤ a, b < p} <strong>of</strong> hash functions 3-universal?<br />

(b) Give a 3-universal set <strong>of</strong> hash functions.<br />

Exercise 7.10 Give an example <strong>of</strong> a set <strong>of</strong> hash functions that is not 2-universal.<br />

Exercise 7.11 Select a value for k and create a set<br />

H = { x|x = (x 1 , x 2 , . . . , x k ), x i ∈ {0, 1, . . . , k − 1} }<br />

where the set <strong>of</strong> vectors H is two way independent and |H| < k k .<br />

Analysis <strong>of</strong> distinct element counting algorithm<br />

Counting the Number <strong>of</strong> Occurrences <strong>of</strong> a Given Element.<br />

Exercise 7.12<br />

(a) What is the variance <strong>of</strong> the method in Section 7.2.2 <strong>of</strong> counting the number <strong>of</strong> occurrences<br />

<strong>of</strong> a 1 with log log n memory?<br />

(b) Can the algorithm be iterated to use only log log log n memory? What happens to the<br />

variance?<br />

Exercise 7.13 Consider a coin that comes down heads with probability p. Prove that the<br />

expected number <strong>of</strong> flips before a head occurs is 1/p.<br />

Exercise 7.14 Randomly generate a string x 1 x 2 · · · x n <strong>of</strong> 10 6 0’s and 1’s with probability<br />

1/ 2 <strong>of</strong> x i being a 1. Count the number <strong>of</strong> ones in the string and also estimate the number<br />

<strong>of</strong> ones by the approximate counting algorithm. Repeat the process for p=1/4, 1/8, and<br />

1/16. How close is the approximation?<br />

260

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!