hash_table.state
Input
Hash table
Current look-up
Match / window
Stored entry
What are Isomorphic Strings
s and t are isomorphic when you can rename the letters of s to obtain t, and the renaming is one-to-one. Two hash maps enforce both directions: s→t and t→s. A second letter trying to reuse a partner breaks the bijection.
egg and add, then switch the second string to bar to see a mapping conflict.Interactive trace
Pseudocode & Complexity
| Operation | Time |
|---|---|
| Each pair of letters | O(1) expected |
| Full scan | O(n) |
| Space | O(Σ) |
Python implementation