Accounting for rebuild work

A hash table's capacity is its number of buckets. During a rebuild, this implementation creates a fresh bucket array and redistributes all stored entries into it.


Initializing each new bucket costs one work unit. Redistributing each stored entry costs one additional work unit, including determining its destination. Count only these two kinds of work; each row describes an independent rebuild with no entries added or removed.


Complete the initialization work, redistribution work, and total work for each row. Enter exact integers in work units.


A hash-table rebuild initializes a fresh bucket array and then redistributes the stored entries.


RebuildOld capacityStored entriesNew capacityInitialization workRedistribution workTotal work
A8616
B201440
C401480

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Hash Tables Questions: