Python sets and dictionaries can have quadratic-time performance

ibobev 12 points 2 comments September 08, 2026
lemire.me · View on Hacker News

Discussion Highlights (2 comments)

0xa2

The map is not the territory.

javcasas

Java's HashMap also has O(log(N)) complexity on hash collision, and that is before memory/cache details. https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.... In fact, some studying on data structures probably leads to the conclusion that it is impossible to guarantee that an unbounded set/map to have access performance under O(log(N)).

Semantic search powered by Rivestack pgvector
5,917 stories · 53,755 chunks indexed