InterviewStack.io LogoInterviewStack.io

Hashing and Hash Tables Questions

How hash tables and hash-based structures work internally, and how to reason about their performance and correctness. Covers hash function properties (determinism, uniform distribution, speed, avalanche effect), cryptographic versus non-cryptographic hash choices, collision resolution (separate chaining, open addressing: linear probing, quadratic probing, double hashing, Robin Hood hashing, cuckoo hashing), load factor and amortized-cost resizing, and what makes an object hashable (the __hash__/__eq__ contract, immutability, custom composite keys). Covers hash-map-backed cache design (LRU and LFU eviction, TTL) and thread-safe concurrent hash maps (lock striping, CAS-based updates, safe concurrent resizing). Also covers hash-based structures beyond arrays and strings: consistent hashing for distributed routing and sharding, hash joins, hash-flooding and algorithmic-complexity security attacks and their mitigations, and probabilistic membership/cardinality structures such as Bloom filters, Cuckoo filters, Count-Min Sketch, and HyperLogLog. Excludes using a hash map purely as an optimization trick inside an array or string problem (two-sum, group anagrams, longest substring without repeating characters); that pattern belongs to Arrays, Strings, and Hashing. This topic is about the hash table itself: how it is built, how it fails under skewed or adversarial input, and how it scales.

MediumTechnical
118 practiced

Compare cryptographic hash functions (e.g., SHA-256) and non-cryptographic hash functions (e.g., MurmurHash, xxHash) for use inside a hash table: key partitioning, building probabilistic sketches, and security-sensitive operations. Discuss trade-offs: speed, collision properties, determinism across versions, and cases where one class is preferred over the other.

HardTechnical
59 practiced

Explain hash collision (hash-flooding) attacks and their effect on hash-table-backed services. As a data engineer, what would you deploy at the application and infrastructure level to make your pipeline's hash tables resilient to an attacker who can choose input keys?

HardTechnical
75 practiced

You are on-call when a production service's 95th percentile latency jumps. Root cause: a hash table used for caching was fed adversarial inputs causing long collision chains and O(n) behavior, resulting in CPU saturation. Describe immediate remediation steps to restore availability, a post-incident analysis plan to determine root cause, and the concrete long-term changes you would propose.

That is every published Hashing and Hash Tables question for Cryptographer so far. Browse the other topics in this category, or practice this one interactively.