Machine-translated by Google. Questions are authored in English.
Top

Discussion

Enlarging a hash table when it becomes too full requires

  • A.rehashing every existing entry into the new bucket array
  • B.copying the entries in their existing order without change
  • C.discarding the entries that were least recently looked up
  • D.nothing at all

Answer: A

The bucket a name belongs to depends on the table size, so every entry must be placed again. The cost is amortised over the many insertions between resizes. Doubling the size each time keeps the amortised cost per insertion constant.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.