Hash Functions
A good hash function must map equal objects to the same number and shouldproduce as few collisions as possible. Each of the following hash functions maps a person’s surname (a string) to an integer in the range 0…25? Which, if any, of these functions would you classify as a “good” hash function? Explain your answer.
a. The sum of the ASCII values of the characters in the string, mod 26.
b. The alphabetical position of the first character in the string; use 0 for ‘A’, 1 for ‘B’,…, 25 for ‘Z’.
c. The alphabetical position of the last character in the string; use 0 for ‘A’, 1 for ‘B’,…, 25 for ‘Z’.
d. The alphabetical position of either the first or last character in the string. The choice of first or last is random.
e. The number of characters in the string.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.