• ↑↓ pour naviguer
  • pour ouvrir
  • pour sélectionner
  • ⌘ ⌥ ↵ pour ouvrir dans un panneau
  • ←→ pour naviguer
  • esc pour rejeter
⌘ '
raccourcis clavier

Framing

Compare four collision resolution techniques for hash tables: separate chaining, linear probing, quadratic probing, and double hashing — analyzing their performance, clustering behavior, and practical trade-offs.

Comparison

TechniqueBest CaseAverage CaseWorst CaseClusteringDeletion
Separate ChainingO(1)O(1)O(n)NoneEasy
Linear ProbingO(1)O(1)O(n)Primary clusteringTombstones
Quadratic ProbingO(1)O(1)O(n)Secondary clusteringTombstones
Double HashingO(1)O(1)O(n)MinimalTombstones

Key Insights

  1. Separate chaining is simplest — each slot has a linked list; performance depends on chain length (load factor α)
  2. Linear probing causes primary clustering — long runs of occupied slots form, increasing probe lengths
  3. Quadratic probing reduces primary clustering but causes secondary clustering (same initial hash = same probe sequence)
  4. Double hashing is best — different step size per key eliminates most clustering, probes all slots if table size is prime
  5. Load factor α ≤ 0.7 is critical — all methods degrade rapidly above this threshold
  6. Open addressing (probing) uses less memory (no linked list pointers) but requires more careful load factor management

Synthesis

The choice depends on use case: separate chaining for simplicity and easy deletion; double hashing for best theoretical performance; linear probing only for very low load factors. All methods require good hash functions and load factor monitoring.

Connections