Measure the search cost of occupied runs

Two 12-slot hash tables use linear probing:


pi=(h+i) mod 12,i=0,1,2,…p_i=(h+i)\bmod 12,\qquad i=0,1,2,\ldots


A slot inspection means reading one table position, whether it is occupied or empty. Each search starts at its home index hh, inspects successive positions, and stops at the first never-used empty slot when the key is absent. Neither table has had deletions.


Layout A has occupied indices 0, 1, 2, 3, 4, and 5. Layout B has occupied indices 0, 1, 4, 5, 8, and 9. Every other slot is never-used empty.


Two twelve-slot arrays show occupied slots grouped together in Layout A and divided into three runs in Layout B.


For searches for absent keys, assume each of the 12 possible home indices is equally likely in each layout. Find the mean number of slot inspections per unsuccessful search for Layout A and for Layout B. Include the terminating empty slot, and give both means in inspections per search to two decimal places.

Your answers

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 Linear and Quadratic Probing Questions: