Dictionaries Hashing Correct Answer Upvoted Assume Hashing Key K Hash Table N Slots Indexe Q37114568

Dictionaries and Hashing – Correct answer upvoted.

Assume that you are hashing key K to a hashtable of n slots (indexed from 0 to n – 1). Foreach of the following functions h(K), answer thefollowing question(s):

1) Is the function acceptable as a hash function (i.e., wouldthe has program work correctly for both insertions andsearches),

2) and if so, is it a good hash function?

Function rand(n) returns a random integerbetween 0 and n – 1. Also assume k is a an integervalues that is >> (potentially much larger than)n.

(a) h(k) = k / n where k and n are integers, k>> n

(b) h(k)

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.