Re: How hash tables work
From: Peter Piper (NoEmail_at_Email.com)
Date: 10/11/04
- Next message: matt parker: "Re: all personals at trueloves.com are fake and the whole site sucks"
- Previous message: Martin Strand: "Re: (Oz vs Delphi), Beating the Wizards of Oz, Part 1 Factorial."
- In reply to: J French: "Re: How hash tables work"
- Next in thread: Maarten Wiltink: "Re: How hash tables work"
- Reply: Maarten Wiltink: "Re: How hash tables work"
- Reply: J French: "Re: How hash tables work"
- Reply: Nicholas Sherlock: "Re: How hash tables work"
- Reply: Bruce Roberts: "Re: How hash tables work"
- Reply: Martin Harvey (Demon account): "Re: How hash tables work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 11 Oct 2004 09:46:14 +0000 (UTC)
Thanks J, I think maybe i have used the wrong phrase and i am trying to
produce a index table. Basically i need to sort my records by more than
one key field eg. Lastname, then firstname. Which i can do using a
binary sort/search but it becomes complicated when i use more than one
field. So i wanted to some how combine the key fields in to one field
and just search on that.
The way to combine the fields could either be by putting them together
as a string or create an integer hash from fields.
In my case it is possible to have duplicate hashes.
J French wrote:
> On Sun, 10 Oct 2004 13:22:27 +0000 (UTC), Peter Piper
> <NoEmail@Email.com> wrote:
>
>
>>Thanks for the information.
>>I was thinking of using hashes to help me search an array of records.
>>So instead of doing a binary search on the first key field in the
>>record, then the next key field, I create a integer hash using the two
>>fields and then search on that instead.
>>Is this a tried and tested method or is there a better approach to my
>>problem?
>
>
> Personally I would sort the records and do a binary chop
>
> However, I think what you are proposing is to produce a form of index
> field. It really depends on your data, it might or might not be
> suitable for representing as an integer.
>
> For example I store the 32 bit CRC of visited URLs in an array and
> scan that to decide whether a link is 'visited'. I tested 10,000 links
> and did not get a single duplicate CRC - but if I did get a duplicate
> in my case it would not matter much.
>
> My vote is always for the simplest approach, 'clever' things tend to
> produce obscure misbehaviour.
- Next message: matt parker: "Re: all personals at trueloves.com are fake and the whole site sucks"
- Previous message: Martin Strand: "Re: (Oz vs Delphi), Beating the Wizards of Oz, Part 1 Factorial."
- In reply to: J French: "Re: How hash tables work"
- Next in thread: Maarten Wiltink: "Re: How hash tables work"
- Reply: Maarten Wiltink: "Re: How hash tables work"
- Reply: J French: "Re: How hash tables work"
- Reply: Nicholas Sherlock: "Re: How hash tables work"
- Reply: Bruce Roberts: "Re: How hash tables work"
- Reply: Martin Harvey (Demon account): "Re: How hash tables work"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|