Hash table element existence check

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Sep 2 12:48:30 PDT 2016


On 9/2/16 3:38 PM, Illuminati wrote:
> I am trying to create a hash table and would like an efficient way to be
> able to know if an element exists to test for collisions.

You mean you are writing your own hash table, or you want to use a D 
hash table (associative array)?

> I could keep a bitarray, but wasting around 12% space. I could use
> pointers(null check) to elements but this creates fragmentation. It is
> not terrible, just curious if anyone has a better way?

I'm not sure I understand the question. Hash tables have many many many 
different ways to implement. Obviously, marking empty buckets somehow is 
necessary.

-Steve


More information about the Digitalmars-d-learn mailing list