Can any one suggest any data structure/code such that if we map 1 to a, 2 to b, 3 to c i.e.
1 --> a
2 --> b
3 --> c
then we can also reverse lookup such as if i query 'a' then it should output 1 and similarly 2 and 3 for 'b' and 'c' respectively.
Also if i change the mapping afterwards from above mapping to :
1 --> a
2 --> a
3 --> c
then after reverse lookup i should get (1,2) for 'a' and (3) for 'c'.
The number to letter direction: a hash. For the letter to number direction: multimap (or a hash where each value is a list)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments