Linear Probing: Analysis

  • Analyze the efficiency of "open address" hash tables.

If there are no collisions, insert/remove and search performance is O(1)\Omicron(1); this is the best-case scenario.

The worst-case scenario is when the probing sequence goes over every occupied position. This scenario leads to O(n)\Omicron(n) performance where nn is the number of items stored in the hash table.

Given an open-address hash table with load factor α\alpha, the expected number of probes in an unsuccessful search (or for inserting an element) is at most:

11α \frac{1}{1 - \alpha}

The statement above can be proved by assuming the hash table employs a uniform hashing function. The proof is beyond the scope of this class. Interested reader is referred to the CLRS: Theorem 11.611.6 and Corollary 11.711.7.

The take-home message: since α<1\alpha < 1 in open-address hash tables, the average (expected) performance is constant time under the assumption of usinform hashing.

Resources