Question: 2 . ( 5 points ) Suppose we have a hash table of size 2 9 and we want to implement a system for looking

2.(5 points) Suppose we have a hash table of size 29 and we want to implement a system for looking
up a friends information given his/her name. Which of the following hash functions is the best?
Justify your choice. (Assuming none of the names is empty.) Short Answer and Letter choice
(a) h(x)= x
(b) h(x)= n %13,where n is the number of characters in x
(c) h(x)=(ord(x[0])+ ord(x[1]))%29, where x[0] is the first character in the name and x[1]
is the last.
(d) h(x)=29
n
(e) h(x)=
i=0
ord(x[i]), where n is the number of characters in x, x[i] the ith character in x,
and ord(c) returns the ordinal value of a character. (Instruction on the \Sigma summation symbol

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!