Monday, March 28, 2016

python - What is the time complexity of evaluating if x in range(n) **Python3**

It seems that in python 3 the check time to evaluate:



if x in range(n)



should be O(1), is it? Can you point me to some documentation?



(In 2.7 ranges are lists so there the time complexity is surely linear)

No comments:

Post a Comment