DATA STRUCTURES/Student Engineering Notebook
Page 09·notes
HASHING, COLLISION DYNAMICS & DISJOINT SETS—~32 MIN READ

Chaining, Universal Hashing & Search Complexity Under Load

“Separate chaining, load factor alpha, expected probe lengths, uniform hashing assumption, and universal hash families.”

1.Separate Chaining Complexity Analysis

Under Simple Uniform Hashing, any key is equally likely to hash into any of the m slots, independently of other keys.

1. Unsuccessful Search:

The search traverses the entire linked list at slot h(k). The expected length of this list is the load factor alpha = n / m. Including the O(1) time to compute the hash function:

E[text{Cost}] = Theta(1 + alpha).

2. Successful Search:

The expected number of elements examined is 1 plus the expected number of elements inserted into the list after key x. On average, this is alpha / 2:

E[text{Cost}] = Theta(1 + alpha / 2).

2.Open Addressing Expected Probe Bounds

In open addressing under the assumption of uniform hashing (each probe is equally likely to be any unoccupied slot):

- Unsuccessful Search: The probability that the first probe is occupied is alpha. The probability that the first two probes are occupied is alpha^2. Total expected probes:

E[P] = 1 + alpha + alpha^2 + alpha^3 + ... = frac{1}{1 - alpha}.

- Successful Search: Each key was inserted when the load factor was smaller. Integrating over the history yields:

E[P] = frac{1}{alpha} ln frac{1}{1 - alpha}.

WORKED EXAM ANALYSIS · STEP-BY-STEP DERIVATIONOriginal Practice Problem · Modeled on GATE Pattern (2 Marks)

3. Worked Problem: Expected Probes Calculation at High Load Factor

⚠️ Pitfall Warning:

Use the natural logarithm ln, not base-10 log, in the successful search probe formula.

Problem: An open-addressed hash table using double hashing operates at a load factor of alpha = 0.75. Calculate the expected number of probes for an unsuccessful search and a successful search.

Step 1: Compute expected probes for Unsuccessful Search:

Formula: E[Unsuccessful] <= 1 / (1 - alpha)

Substitute alpha = 0.75 = 3/4:

E[Unsuccessful] <= 1 / (1 - 0.75) = 1 / 0.25 = 4 probes.

Step 2: Compute expected probes for Successful Search:

Formula: E[Successful] <= (1 / alpha) * ln(1 / (1 - alpha))

Substitute alpha = 0.75:

ln(1 / (1 - 0.75)) = ln(1 / 0.25) = ln(4) approx 1.3863.

E[Successful] <= (1 / 0.75) 1.3863 = (4 / 3) 1.3863 = 1.848 probes.

Final Answer: Unsuccessful search expects 4.0 probes; Successful search expects approximately 1.85 probes.

SOURCE TRANSPARENCY & CITATIONS

Primary Academic References & Exam Sources

Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.

Curated University Lecture Series
Introduction to Algorithms (4th Edition) ·
LECTURE SERIES
RECOMMENDED YOUTUBE EDUCATORS & FULL-COURSE PLAYLISTS

Curated for clarity, rigorous numerical solving, and semester excellence:

Abdul Bari · Data Structures & Algorithms↗Instructor: Abdul Bari · Covers: Trees, graphs, hashing, sorting — with visual algorithm animations

Visual thinkers who want to see each algorithm step animated clearly.

Open YouTube↗
Gate Smashers · Data Structures Full Course↗Instructor: Varun Singla · Covers: Arrays, linked lists, trees, BST, AVL, heaps, hashing — GATE numericals

GATE-targeted coverage with step-by-step GATE PYQ walkthroughs.

Open YouTube↗