ProgrammingVery hard

A chained hash table is resized by doubling whenever it becomes full, starting at capacity 1. Inserting 8 keys, how many element moves does the resizing do in total?

  1. A. 8
  2. B. 4
  3. C. 7
  4. D. 15

Correct answer: C. 7

Resizes happen when inserting the 2nd, 3rd and 5th keys, and they move 1, 2 and 4 elements. 1 + 2 + 4 = 7, which is less than 8.

More C Programming questions

Exams that ask this topic