From: Robert Klemme Date: 2006-08-14T06:05:09+09:00 Subject: Re: A use case for an ordered hash Hal Fulton wrote: > 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"? Probably. I'm not a native speaker so I'm certainly not authoritative on this matter. :-) > 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. That probably also depends on the frequency of lookups. :-) But yes, my hashes are typically larger (although I also use small ones). > 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.) Interesting. GoOd (n)ight robert ;-)