Re: fast dictionary search algorithm
From: CBFalconer (cbfalconer_at_yahoo.com)
Date: 02/10/04
- Next message: Dilton McGowan II: "Re: How to Redirect stdin and stdout?"
- Previous message: David Turner: "Re: Why C# and Java have got it wrong"
- In reply to: Paul Hsieh: "Re: fast dictionary search algorithm"
- Next in thread: Paul Hsieh: "Re: fast dictionary search algorithm"
- Reply: Paul Hsieh: "Re: fast dictionary search algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 10 Feb 2004 08:16:34 GMT
Paul Hsieh wrote:
> prashanthellina@gmx.net (Prashanth Ellina) wrote:
> >
... snip ...
> >
> > I have considered hashing and multiple level hashing as an option
> > but am not sure about the hash function. People tell me it is
> > difficult to avoid collisions. Have tried binary search, however
> > need something faster.
>
> Collisions are not fatal. And they aren't necessarily slow if you
> don't go the route of rehashing. For example, for all the entries
> that land on a given hash index, simply place them all into a sorted
> binary, and use binary search on them from there. In this way you get
> the benefit of the massive narrowing of your search via hashing, and
> the O(log(n)) guarantee of the binary tree at the same time.
Nor are they slow if rehashed. A reasonable system will never
need more than two hashes total, and will be O(1) for all
searches.
-- Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net) Available for consulting/temporary embedded and systems. <http://cbfalconer.home.att.net> USE worldnet address!
- Next message: Dilton McGowan II: "Re: How to Redirect stdin and stdout?"
- Previous message: David Turner: "Re: Why C# and Java have got it wrong"
- In reply to: Paul Hsieh: "Re: fast dictionary search algorithm"
- Next in thread: Paul Hsieh: "Re: fast dictionary search algorithm"
- Reply: Paul Hsieh: "Re: fast dictionary search algorithm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|