A
Anno Siegel
John Bokma said:[hashes]
Fine. My point is that there are useful applications of hash tables
also in the O(n) range.
Uhm, like? (Ok, memory stress testing is one).
It's a simple space/time tradeoff. You only get constant access time
when collisions are rare, so the number of buckets must be larger than
the number of keys. Say you expect a million keys and linear search
is too slow by a factor of 100. Use a hash with 100 buckets (some more
to compensate overhead). That gives you the necessary speedup with
almost no memory overhead, as opposed to a hash of more than a million
buckets for constant access time. That's a useful hash application
well in the linear range.
Anno