2017 Homework 5 Solutions.pdf

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

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.
Image of page 1
You've reached the end of this preview.
  • Fall '09

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern