1.a) 1.b ) 1.c ) 1.d ) 2.a ) 2.b )
Posted: Tue Jul 12, 2022 8:20 am
1.a)
1.b )
1.c )
1.d )
2.a )
2.b )
Linear probing is one of the methods to solve a collision in hashing. If a hashing function is defined as h(k) = k % 7, show the linear probing equation and explain how it works. (4 markah/marks)
"/ Given that there are six workers in a shop, with IDS 909, 185, 657, 116, 85, and 150. Suppose hash table HT is of the size 7 and indexed 0, 1, 2, .. 6. Show how these workers' IDs, in the order given, are inserted in HT using the hashing function h(k) = k % 7. Use linear probing to resolve any collisions. Answer by using Table 1 and explain all collisions in the hash table. Jadual 1: Jadual cincang dan data Table 1: Hash table and data HT[0] HT[1] HT[2] HT[3] HT[4] HT[5]
Illustrate the chaining for IDs listed in (b). Hashing function is defined as h(k)= k % 7. (5 markah/marks)
Analyze the collision resolution between open addressing with a linear probing approach and a chaining approach. Which approach is most suitable for the ID hashing as discussed in (b)? Explain your answer. (3 markah/marks)
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.b )
1.c )
1.d )
2.a )
2.b )
Linear probing is one of the methods to solve a collision in hashing. If a hashing function is defined as h(k) = k % 7, show the linear probing equation and explain how it works. (4 markah/marks)
"/ Given that there are six workers in a shop, with IDS 909, 185, 657, 116, 85, and 150. Suppose hash table HT is of the size 7 and indexed 0, 1, 2, .. 6. Show how these workers' IDs, in the order given, are inserted in HT using the hashing function h(k) = k % 7. Use linear probing to resolve any collisions. Answer by using Table 1 and explain all collisions in the hash table. Jadual 1: Jadual cincang dan data Table 1: Hash table and data HT[0] HT[1] HT[2] HT[3] HT[4] HT[5]
Illustrate the chaining for IDs listed in (b). Hashing function is defined as h(k)= k % 7. (5 markah/marks)
Analyze the collision resolution between open addressing with a linear probing approach and a chaining approach. Which approach is most suitable for the ID hashing as discussed in (b)? Explain your answer. (3 markah/marks)
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)