Problem Statement
What is the average time complexity to test membership in a Python set?
Explanation
Sets are hash tables, so membership tests are constant time on average. Lists are linear time because they scan elements.
Use sets for fast membership checks, deduplication, and set operations like union and intersection.
Code Solution
SolutionRead Only
s = {1,2,3}
print(2 in s) # fast