Assuming I have the following code, I have some questions.
>>> asd = {}
>>> asd[1] ='a'
>>> asd[2] = 'b'
>>> asd[3] = 'c'
>>> asd
{1: 'a', 2: 'b', 3: 'c'}
>>> dict((v,k) for k, v in asd.iteritems())
{'a': 1, 'c': 3, 'b': 2}
>>> if 'a' in asd:
print("1")
>>> if 'a' in dict((v,k) for k, v in asd.iteritems()):
print("1")
1
When I reverse a dictionary how much time will it take assuming my dictionary contains 10gb+ of data.
If I do not store the reversed dictionary to another dict then reversing it by itself as an instance will it consume space over memory?
I need the reversed dictionary because I want O(1) lookups over values, for some operations. Some others require key lookups.