I am trying to prepare for an exam and I am not sure how to solve this task:

Given is a hash function with m buckets, which uses a 1-universal hash function h: U -> H and handles collisions with lists. The table was filled with n keys.

1)Specify the probability that the first bucket in the table is empty.

2) How should m be chosen as a function of n such that the expected total number of collisions is in O (1)?

My idea:

1) -probability that it lands in one bucket: 1/m

-probability that it lands in a particular bucket: 1- 1/m

-probability that after n inserts, the first bucket is empty: $(1-1/m)^n$

2) $\Omega(n^2)$

Did I do that right?

  • 2
    $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$ – D.W. Mar 7 '19 at 21:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.