2017 Homework 5 Solutions.pdf

# 2017 Homework 5 Solutions.pdf - CS 161 Homework 5 Solutions...

• Homework Help
• 3

This preview shows page 1 out of 3 pages.

CS 161: Homework 5 Solutions 1. (a) Given a new sentence ? , we output “fresh” if ? hashes to an empty bucket - ie if ? hashes to a different bucket than the 1 billion sentences. The probability that s hashes to the same bucket as a given sentence is 1 ? , so the probability that s hashes to a different bucket than a given sentence is 1 1 ? . So the probability that s hashes to a different bucket than the 1 billion sentences is (1 1 ? ) 1billion . Solving for ? yields that ? should be at least 100 billion. (b) i is an integer between 1 and 10 billion. The probability that a given ? (1 ? 10) hashes a given sentence to i, is: 1 10 billion . So, the probability that a given ? hashes a given sentence to another value than i, is: 1 1 10 billion . So, the probability that a given ? hashes ALL 1 billion sentences to another value than i, is: (︀ 1 1 10 billion )︀ 1 billion . And the probability that ALL 1 , 2 ... 10 hash ALL 1 billion sentences to another value than i is: (︀ (1 1 10 billion ) 1 billion )︀ 10 = (︁ 1 1 10 billion )︁ 10 billion 1 /? 0 . 37 . Each element A[i] is equal to 0 if and only if ALL 1 , 2 , 3 ... 10 map ALL 1 billion sentences to another value than i. By linearity of expectation, the expected fraction of 0’s in A is simply the probability that a given element of A is equal to 0: (︁ 1 1 10 billion )︁ 10 billion (c) If a sentence s is in our set of 1 Billion sentences, the array A already contains 1’s at positions 1 ( ? ), 2 ( ? )... 10 ( ? ). So we will output ”potential problem” with probability 1.
You've reached the end of this preview.
• Fall '09

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern