In Python, what is the efficiency of the in keyword, such as in:
in
a = [1, 2, 3] if 4 in a: ...
The complexity for lists is:
O(n)
For sets it is:
O(1)
http://wiki.python.org/moin/TimeComplexity
1.4m articles
1.4m replys
5 comments
57.0k users