1.a) Linear probing is one of the methods to solve a collisionin hashing. if a hashing function is defined as h(k) = k %7, showthe linear probingequation and explain hpw it works. (4 marks)
b) Given that there are isx workers in a shop,with IDs 909,185,657,116,85, and 150. suppose hash table HT is ofthe size 7 and indexed 0,1,2,...,6. show how these woeker's IDs, inthe order given, are insterted, in HT using the hashingfunction h(k) = k % 7. Use linear probing to resolve any collision.Answer by using Table 1 and explain all collision in the hashtable.
c) Illustrate the chaining for IDs listed in (b).Hashing function is defined as h(k) = k %7. (5 marks)
d) Analyze the collision resolution between openaddressing with a linear probing approach and a chaining approach .Which approach is most suitable for the ID hashing asdiscussednin (b)? (3 marks)
2.a)
Table 1: Hash table and data HT[0] HT[1] HT[2] HT[3] HT[4] HT[5] HT[6] 5/9
Given a list of items: 80, 57, 65, 30, 45, 77, 27, 4, 90, 54, 45, 2, 63, 38, 81, 28, 62. Illustrate the sorting of the list using Shellsort using a range of 7, 4, and 1. (12 markah/marks)
Illustrate the sorting of the list using Selection Sort. (8 markah/marks)
1.a) Linear probing is one of the methods to solve a collision in hashing. if a hashing function is defined as h(k) = k
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am