Monday, 28 March 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

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...