In Python, we know that looking up a key in a dictionary takes O(1) run time, but what is the run time to look up in the dictionary.values() ?
dictionary = {'a':[66,77,88], 'b':[99,100]}
key = 'a'
if key in dictionary: # takes O(1) run time
number = '99'
if number in dictionary.values(): # What is the run time here?
Edit #1: The values for the keys could be either lists or sets. Many folks have responded that if the values are lists the run time is O(1).
Will it be O(N) if values are sets?
dictionary = {'a':(66,77,88), 'b':(99,100)}
number = '99'
if number in dictionary.values(): # What is the run time here?