I have referred to this page but it shows Dict.keys()'s time complexity. https://wiki.python.org/moin/TimeComplexity
This sheet also shows the same https://www.geeksforgeeks.org/complexity-cheat-sheet-for-python-operations/
Time complexity for lookup in dictionary.values() lists vs sets
In this case, it searches for each key's list
so it didn't help me.
Because in my case, all Dict's values will be a single integer.
Q(1): Is it O(1) or O(n) for Dict.values()?
Dict = {1:10,2:20,3:30,4:40}
if 10 in Dict.values():
print("YES")
Q(2): In python is it possible to get key by supplying value?[if the supplied value comes multiple times in Dict.values() I would like to get all corresponding keys]
Dict = {1:10,2:20,3:30,4:40}
value = 20
I want to find key=2 by this value. Is it possible with O(1), because in O(n) I have to check for all key's value!!!