Linear Probing: Analysis
- Analyze the efficiency of "open address" hash tables.
If there are no collisions, insert/remove and search performance is ; this is the best-case scenario.
The worst-case scenario is when the probing sequence goes over every occupied position. This scenario leads to performance where is the number of items stored in the hash table.
Given an open-address hash table with load factor , the expected number of probes in an unsuccessful search (or for inserting an element) is at most:
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 and Corollary .
The take-home message: since in open-address hash tables, the average (expected) performance is constant time under the assumption of usinform hashing.
Resources
- Wikipedia entry on Hash Table: Performance.