|
|
|
|
|
by continuational
3603 days ago
|
|
It's a common misconception that hashmaps have constant time lookups. In order for the lookup to be constant time, the hash function must output enough bits to avoid causing too many collisions. For example, 16 bits is too little for a hash map with a million keys. In fact, the hash function output size should be O(log(n)) where n is the number of entries. Processing log(n) bits takes at least O(log(n)) time. QED |
|
No, because log(n) might be smaller than the word size of the machine, which is the common case for hash table implementations.