Do have hash function without any collisions for this keys

Do have hash function without any collisions for this keys
0

Suppose keys 16,32,40,48,56,72 must be inserted into a hash table with 10 slots can anyone create a hash function in key = 16, 32, 40, 48, 46, 72

example 16 if I calculate with this function

16 * 2 = 32 % 10 = 2 || 32*2 = 64 % 10 = 4|| 40 * 2 = 80 % 10 = 0 || 46 * 2 = 92 % 2 = 9 || 96 % 10 = 6 72 * 2 = 144 % 10 = 4 > this is a collisions if any one know any method

[40] [ ] [16] [ ] [32] [ ] [48] [ ] [ ] [46]

i have try function

  • h(k*2)%10
  • h(2*k-3)%10

any idea.

Ignoring the tenth slot, when I apply %9, those six numbers all land on different slots.

Or, since they are all divisible by 8, divide by 8.

1 Like

but the task is for 10 slots are you say to go with this hash fucion like h(k*2)%10-1