Robert Klemme wrote:
> Hal Fulton wrote:
>>
>> I never use a hash for fast lookup. I use it because it
>> allows me easily to associate an arbitrary key with a
>> value.
> 
> Um...  So you're saying that you wouldn't bother if lookups were O(n)?  
> Wow!

I think you mean "wouldn't care"?

Anyway: I'm happy that lookups are fast. But 99% of the time,
my hashes are small enough that the time savings is probably
very small in terms of program execution time.

If I were storing 20 million elements, I wouldn't use a Hash
either. I'd either use a database or flat file; or if I
needed it in RAM I might customize something (or likely use
the red-black tree implementation).

I'm a late-optimizer. Until you mentioned it now, I had never
thought of speed as a reason to use a hash. (Although, if you
had asked me, I'd have said it was faster than O(n), of course.)


Hal