liveBook · Manning

Double hashing

As explained in Advanced Algorithms and Data Structures

A double hashing function derives multiple hash values or positions from two base hash results.

Double hashing derives several positions from two base hash results. In a Bloom filter, it avoids maintaining many independent hash implementations while producing the bit indices needed for insertion and lookup. section 4.5 section 4.6.3

A practical construction proceeds as follows:

  • Hash the key with MurmurHash32 and FNV-1 to obtain hM and hF. section 4.6.3
  • For each index i from 0 through k−1, compute hi(hM, hF) = (hM + i × hF + i²) mod m. section 4.5 section 4.6.4
  • Use the resulting k positions to set or inspect bits; retain a seed when deterministic tests, serialization, or restart behavior matter. section 4.6.3

Bloom-filter position generation

Given two base hashes, the initialized function for i = 2 returns (hM + 2hF + 4) mod m. Repeating this for every i produces the bit positions for one key. section 4.5 section 4.6.4

How Advanced Algorithms and Data Structures covers it

How deep it goes
Explains the construction, formula, initialization, deterministic seeding, and position-mapping procedure, but not formal collision analysis.
Examples
Uses MurmurHash32, FNV-1, modular position formulas, and Bloom-filter bit-array insertion and lookup.
What it assumes
Assumes hash functions and Bloom-filter bit arrays, while defining how two hashes generate k positions.
What you can do after
Build it from scratch by initializing position functions and mapping keys to deterministic Bloom-filter bit indices.
How it connects
Connects double hashing to Bloom filters, hash collisions, independent hash functions, linear hashing, quadratic hashing, and uniform hashing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.