-1

I know that SO might be the wrong place to look for answers to questions such as these, but at the moment I need the answer and how to work it out step by step urgently.

Suppose that we are using extendable hashing on a file that contains records with the following search-key values: 2, 3, 5, 7, 11, 17, 19, 23, 29, 31 Show the extendable hash structure for this file if the hash function is h(x) = x mod 8 and buckets can hold three records.

EDIT: I have the "supposed" answer to this: https://i.stack.imgur.com/jmMQO.png But I am not sure if this is correct, since when I work it out, I get a different hash structure. If it is correct, could anyone explain to me why?

user2345414
  • 1
  • 1
  • 2

1 Answers1

0
h(2) = 2 => 0, 0, 2, 0, 0, 0, 0, 0
h(3) = 3 => 0, 0, 2, 3, 0, 0, 0, 0
h(5) = 5 => 0, 0, 2, 3, 0, 5, 0, 0
h(7) = 7 => 0, 0, 2, 3, 0, 5, 0, 7
h(11) = 3 => 0, 0, 2, { 3, 11 }, 0, 5, 0, 7
h(17) = 1 => 0, 17, 2, { 3, 11 }, 0, 5, 0, 7
h(19) = 3 => 0, 17, 2, { 3, 11, 19 }, 0, 5, 0, 7
h(23) = 7 => 0, 17, 2, { 3, 11, 19 }, 0, 5, 0, { 7, 23 }
h(29) = 5 => 0, 17, 2, { 3, 11, 19 }, 0, { 5, 29 }, 0, { 7, 23 }
h(31) = 7 => 0, 17, 2, { 3, 11, 19 }, 0, { 5, 29 }, 0, { 7, 23, 31 }
unxnut
  • 8,509
  • 3
  • 27
  • 41