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’.