I am analysing some code I have written for its best and worst time complexity. I have been stuck for a while trying to understand what pythons if x in y best time complexity is as I haven't found many resources mentioning it.My understanding is that in the best case scenario list = [3, 1, 4, 5, 7], element 3 would be retrieved in constant time as it exists at the beginning of the list.
↧
Best time complexity of python 'if x in y' when checking a list [duplicate]
↧