Skip to content

English practice

Reading: Multiple Choice, Multiple Answers · Question 244

Hash table complexity

PTE · Reading · hard

Read the text and answer the question by selecting all the correct responses. More than one response is correct.

A pervasive conception among computer science students is that hash tables invariably provide constant-time, O(1) performance for insert, search, and delete operations. Textbook data structures curricula frequently emphasize this theoretical bound, implicitly assuming an idealized setting with infinite memory, perfectly uniform hash functions, and negligible lookup overhead. In practical computing environments, however, achieving true constant-time execution is an empirical impossibility across arbitrary workloads. The first discrepancy stems from the fundamental inevitability of hash collisions. According to the birthday paradox, collisions begin to occur long before a table reaches full capacity. When distinct keys map to identical memory buckets, secondary resolution mechanisms—such as separate chaining or open addressing—must resolve the conflict. In worst-case conditions, or under deliberate algorithmic complexity attacks where an adversary feeds carefully crafted colliding keys, lookup operations degrade to linear time, O(n), transforming the table into an inefficient linked list. Furthermore, modern microprocessors depend heavily on hierarchical hardware caches. Hash tables distribute data pseudorandomly across a vast address space to avoid structural clustering. This scattershot memory distribution destroys spatial locality of reference, causing frequent central processing unit cache misses. As a consequence, reading a key from a hash table often forces expensive memory bus transactions, rendering linear array scans faster in practice for small collections.

Based on the passage, which of the following statements about hash table operations in practice are true?

  • Hash tables retain constant-time complexity even when subjected to deliberate hash collision attacks.
  • The pseudorandom layout of keys in memory undermines spatial locality and increases processor cache misses.
  • Hash collisions begin to emerge only after an allocated hash table becomes completely full.
  • Under adverse collision scenarios, search performance can deteriorate from constant to linear time.
  • Sequential array scans are consistently slower than hash table lookups regardless of the dataset size.
  • Theoretical proofs of constant-time performance typically presume the presence of flawless hashing algorithms.