Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(coding in java) Given keys as {17, 49, 21, 46, 50, 80, 57, 81, 11, 71} and thei

ID: 3707148 • Letter: #

Question

(coding in java)
Given keys as {17, 49, 21, 46, 50, 80, 57, 81, 11, 71} and their associated values as {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} respectively. Show the contents of the hash table after inserting those key values pairs into an initially empty hash table with size 13 using the following conflict resolution methods discussed in class: a) Separate chaining. When there is a search miss, insert new key into the first node of the linked list. b) Linear probing without resizing.

Explanation / Answer

Since size is 13 , we need to take modulo with 13 to determine the position 17 % 13 => 4 49 % 13 => 10 21 % 13 => 8 46 % 13 => 7 50 % 13 => 11 80 % 13 => 2 57 % 13 => 5 81 % 13 => 3 11 % 13 => 11 71 % 13 => 6 a) Using chaining: Here Pair (x,y) , y is the value 0 -> 1 -> 2 -> (80, 5) 3 -> (81, 7) 4 -> (17, 0) 5 -> (57, 6) 6 -> (71, 9) 7 -> (46, 3) 8 -> (21, 2) 9 -> 10 -> (49, 1) 11 -> (11, 8) -> (50, 4) 12 -> b) Using Linear probing: 0 -> 1 -> 2 -> (80, 5) 3 -> (81, 7) 4 -> (17, 0) 5 -> (57, 6) 6 -> (71, 9) 7 -> (46, 3) 8 -> (21, 2) 9 -> 10 -> (49, 1) 11 -> (11, 8) 12 -> (50, 4)