I am currently learning about data structures in Python. I understand that searching for an element in a List requires O(n) linear time. However, I read that searching a Set has an average time complexity of O(1) because it is implemented using a hash table. Can someone confirm if this O(1) lookup time remains consistent in CPython even when there are hash collisions, or does it degrade to O(n) in the worst-case scenario? Thanks! submitted by /u/Electronic-Low9797 [link] [comments]