Description
1. A. Store the following numbers in 5 buckets using any hash function (use
separate chaining to avoid collision)
35, 26, 12, 24, 43, 38, 37, 41, 22, 11, 15
B. Search for an element in the hash table.
C. Delete 38 from hash table.
D. Display hash table after each operation.
2. Store the strings {“abcdef”, “bcdefa”, “cdefab” , “defabc” } using the following
hash function.
The index for a specific string will be equal to sum of ASCII values of characters
multiplied by their respective order in the string after which it is modulo with
2069 (prime number)
String Hash_function Index
abcdef (97*1 + 98*2 + 99*3 + 100*4 + 101*5 + 102*6)%2069 38
bcdefa (98*1 + 99*2 + 100*3 + 101*4 + 102*5 + 97*6)%2069 23
cdefab (99*1 + 100*2 + 101*3 + 102*4 + 97*5 + 98*6)%2069 14
defabc (100*1 + 101*2 + 102*3 + 97*4 + 98*5 + 99*6)%2069 11