Expected cost of a mixed lookup workload

A hash table with separate chaining holds 10001000 keys in 250250 buckets, spread uniformly. A successful lookup examines about 1+α21 + \tfrac{\alpha}{2} entries on average and an unsuccessful lookup about α\alpha entries, where α\alpha is the load factor. In a workload where 75%75\% of lookups are for absent keys (unsuccessful) and 25%25\% hit a present key (successful), what is the expected number of entries examined per lookup?

Show hints (2)+
  1. First α=n/m=4\alpha = n/m = 4; then unsuccessful costs α\alpha, successful costs 1+α/21+\alpha/2.
  2. Weight by the workload: 0.754+0.2530.75\cdot 4 + 0.25\cdot 3, not a plain average.

Answer

Reveal answer →

3.75

Want the full step-by-step worked solution? It's part of Premium - along with a worked solution for every question in the bank.

Asked at: Multi-Strategy Quant, Data-Driven Research

Related questions