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

lun completion Status: QUESTION 1 2 points Save What is the range of values comp

ID: 3709356 • Letter: L

Question

lun completion Status: QUESTION 1 2 points Save What is the range of values computed by the hash function hash(x)-x % 100? 0 to 99 O o to 100 to 99 O 1 to 100 QUESTION 2 3 points When linear probing is used to manage collisions in a hash table, how are elements deleted so that a search operation is able to traverse over all elements that hash to a given index location? O A the element reference array[iJ.element is made null B. the HashEntry reference array[i] is made null C. thay are changed to zerco D. they are marked defunct E. none of the above QUESTION 3 2 points Save A Multiple entries with the same key are allowed in maps

Explanation / Answer

1. Ans: 0 to 99.

The function hash(x) is formed on the formula of x%100. That means for an element x it’s hash value will be x%100. And for mod(100) the available values will be 0, 1, 2,….99.

Example 23 % 100 = 23,1200 % 100 = 0 etc.

2. Ans: HashEntry reference array[i] is made null.

In linear probing, the collision of two elements (say 200 and 400) that have same hash value(0) can be resolved by searching next empty location for the later value in the hash table.

But when deletion is done in the hash table, the location of the former element (200) is made NULL in the hash table. So, when the element is searched in the hash table at that location, it is not found (because its NULL). So, in this case, the algorithm traverses all the elements that had that hash value (or location in hash table).