Implement a reverse hash table
Utilisateur anonyme
As a way to make it as space-conserving as possible, the key->value pair can be inserted at the hashes of both the key and value. This would allow you to both differentiate a forward and reverse lookup, and use only a single additional pointer of space per entry.