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

Inserrt the following sequence of integers into a hash table of size 13. As the

ID: 3696459 • Letter: I

Question

Inserrt the following sequence of integers into a hash table of size 13. As the hash function of entry value use (3*value) % 13

(Example to insert '6' the hash function returns 5). Use open addressing with linear probing. in the hash table's bottom row, please enter the number of collisions that occured on insertion of each element (collision counts for already inserted values do not change).

sequence of numbers (3, 16, 42, 5, 2, 1) insert in the give order

Hash Table:

Index 0 1 2 3 4 5 6 7 8 9 10 11 12 Value Collisions

Explanation / Answer

Inserting 3

hashVal = 3 * 3 % 13 = 9

no collisions

Inserting 16

hashVal = 3 * 16 % 13 = 48 % 13 = 9

element at 9 already exists. hence we place it in 10.

1 collision

Inserting 42

hashVal = 3 * 42 % 13 = 126 % 13 = 9

element at 9, and 10 already exists

hence we place it in 11

2 collisions

inserting 5

hashVal = 3 * 5 % 13 = 15 % 13 = 2

we place it at 2. No collisions

inserting 2

hashVal = 3 * 2 % 13 = 6

we place it at 6. No collisions.

inserting 1

hashVal = 3 * 1 % 13 = 3

we place it at 3. No collisions

Index 0 1 2 3 4 5 6 7 8 9 10 11 12 Value 3 Collisions 0