Menu

📰
0

Reddit - Please wait for verification

Python Education·/u/Electronic-Low9797·3 days ago
#ztzGk8RH
Reading 0:00
15s threshold

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]

Read More