Question: 4. Consider the following person database and hash function: Table 3: Person Database Name Ross } Chandler Monica Age 32 int hash_function(person P) {

4. Consider the following person database and hash function: Table 3: Person Database Name Ross } Chandler

4. Consider the following person database and hash function: Table 3: Person Database Name Ross } Chandler Monica Age 32 int hash_function(person P) { 36 30 string name P. name; int age P.age; int sex P.sex; int mod = 18; int hash name.size(); } return hash % mod; Sex Male Male Female if(sex == "Female") hash++; for (int i = 0; i < name.size(); i++){ int ascii_val = (int)name[i]; hash + ascii_val - 97; Figure 1: Hash function a) Calculate the hash values using the given hash function for all the entries in the person database. b) Create two additional non duplicate entries in the database with age less than 40, for which the calculated hash value using the given hash function will collide with at least one of the existing entries' hash values. c) With proper justification, propose two modifications in the given hash function that will lessen the probability of collision between multiple entries. 5 (CO1) (POI) 10 (CO4) (PO3) 10 (C04) (PO3)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Step 1 Lets go through the explanation step by step Step 1 Calculate Hash Values for Existing Entries Explanation For each existing entry in the person database we apply the provided hash function to ... View full answer

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 Programming Questions!