Probabilistic Data Structures & Hashing Questions
Covers probabilistic data structures (e.g., Bloom filters, Count-Min Sketch, HyperLogLog, Cuckoo filters) and hashing techniques, including space-time trade-offs, false positive rates, distinct element estimation, and practical applications in databases, caches, streaming analytics, and network systems.
MediumTechnical
39 practiced
Implement a thread-safe Count-Min Sketch in Java or Scala with API: constructor(width int, depth int), add(String key, long count), estimate(String key): long, merge(CountMinSketch other), serialize()/deserialize(). Describe your choice of hashing per row and concurrency primitives to allow high update throughput in multi-threaded environments.
EasyTechnical
30 practiced
Explain Locality-Sensitive Hashing (LSH). Describe concrete LSH families used for cosine similarity (SimHash) and Jaccard similarity (MinHash), how banding or buckets work, and give a data-engineering example where LSH would be applied in a streaming pipeline to find near-duplicates.
EasyTechnical
36 practiced
Implement a BloomFilter class in Python with the following API: BloomFilter(m: int, k: int), add(item: bytes), might_contain(item: bytes)->bool. Use double hashing to derive k indices: h1 = murmur3_64(item, seed=0), h2 = murmur3_64(item, seed=1), and index_i = (h1 + i * h2) % m. Use Python's bytearray or built-in types for bit storage and document time/space complexity.
EasyTechnical
37 practiced
Explain HyperLogLog (HLL) at a high level: what quantity it estimates, how it uses stochastic averaging and leading-zero counts, the role of the precision parameter p (number of registers = 2^p), typical space complexity and approximate error as a function of p. Provide two practical cases where HLL is preferable to exact counting in a data engineering stack.
HardTechnical
37 practiced
Compare MinHash (for Jaccard similarity) and SimHash (random projection for cosine similarity): explain how each constructs a compact sketch, the types of similarity they approximate, expected sketch sizes for a target error, and recommend which to use for near-duplicate document detection in a streaming ETL pipeline that uses shingling.
Unlock Full Question Bank
Get access to hundreds of Probabilistic Data Structures & Hashing interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.