Question: Hashing distributes keys uniformly among a one-dimensional array ht[0,m) called a hash table [2] . Keys are distributed as follows: a value is assigned to

 Hashing distributes keys uniformly among a one-dimensional array ht[0,m) called a

Hashing distributes keys uniformly among a one-dimensional array ht[0,m) called a hash table [2] . Keys are distributed as follows: a value is assigned to each key using a predefined function called a hash function. This function maps a key to an integer between 0 and m1, called the hash address. So if keys are nonnegative integers, a hash function can be of the form h(k):=k mod m. What happens if a key is a character string coc1 cs1 of length s ? How would you apply the same kind of function used for integers? a. Specify a hash function when k is a character string. b. Consider extreme cases of the specification and instances needing clarifi cation. For instance, what happens when we choose a hash table's size m to be smaller than the number of keys n. c. Provide an algorithm that meets the specification. Note that this question is not asking for code. d. Downcode the algorithm in Python and test with keys that are integers and those that are character strings

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!