Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Finding unique items: hash vs. sort. Parent comment
O(1), hah, I wish!
Yes, there is the caveat of constant k, but in practice this is usually implied for integer keys e.g., the int32 integers used in the OP.
If the keys become arbitrarily long, hash tables also become O(n log k) since you have to hash and compare log k bits of key state.
There are no comments on this comment yet.
O(1), hah, I wish!
Yes, there is the caveat of constant k, but in practice this is usually implied for integer keys e.g., the int32 integers used in the OP.
If the keys become arbitrarily long, hash tables also become O(n log k) since you have to hash and compare log k bits of key state.