hash_table.state
Input
Hash table
Current look-up
Match / window
Stored entry
What is a Subset Check
A is a subset of B when every value of A also exists in B. Hash B, then probe once per element of A. The first miss proves “not a subset”. If every probe hits, A ⊆ B.
1, 2, B = 1, 2, 3, 4. Both probes hit. Try A = 1, 5 to watch a miss.Interactive trace
Pseudocode & Complexity
| Operation | Time |
|---|---|
| Build set(B) | O(m) |
| Probe A | O(n) |
| Space | O(m) |
Python implementation