logoalt Hacker News

emil-lptoday at 4:38 PM2 repliesview on HN

> To put it differently, saying that a hash table is O(1) or constant time is a model

Nobody really says that, nor is it a model. It is the expected time complexity.


Replies

t-writescodetoday at 6:21 PM

People … say that all the time. *I* say that all the time. It’s true enough to be accurate in 99.9% of the cases; and we put barriers in place when implementing code (like configuring the hashing algorithm) to keep it that way.

robertlagranttoday at 5:08 PM

I think people do say a hash table is O(1). It's the average time complexity (for some value of average) though, not the worst case.

show 2 replies