Re: Hash table element existence check

2016-09-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/3/16 8:30 AM, Illuminati wrote: Yes, one must have a way to mark empty "buckets"(I hate that term! Seems so banal for some reason ;/) If using pointers, which is what I use, then null means empty, but one can't use inline structs and which then can create data fragmentation. If the structs

Re: Hash table element existence check

2016-09-04 Thread Illuminati via Digitalmars-d-learn
On Saturday, 3 September 2016 at 14:07:27 UTC, Cauterite wrote: On Saturday, 3 September 2016 at 12:33:26 UTC, Illuminati wrote: On Saturday, 3 September 2016 at 07:44:28 UTC, Cauterite wrote: On Friday, 2 September 2016 at 19:38:34 UTC, Illuminati wrote: I am trying to create a hash table and

Re: Hash table element existence check

2016-09-03 Thread Cauterite via Digitalmars-d-learn
On Saturday, 3 September 2016 at 12:33:26 UTC, Illuminati wrote: On Saturday, 3 September 2016 at 07:44:28 UTC, Cauterite wrote: On Friday, 2 September 2016 at 19:38:34 UTC, Illuminati wrote: I am trying to create a hash table and would like an efficient way to be able to know if an element exi

Re: Hash table element existence check

2016-09-03 Thread Illuminati via Digitalmars-d-learn
On Saturday, 3 September 2016 at 09:43:04 UTC, Basile B. wrote: On Friday, 2 September 2016 at 19:38:34 UTC, 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. I could keep a bitarray, but wastin

Re: Hash table element existence check

2016-09-03 Thread Illuminati via Digitalmars-d-learn
On Saturday, 3 September 2016 at 07:44:28 UTC, Cauterite wrote: On Friday, 2 September 2016 at 19:38:34 UTC, 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. Just do a regular lookup on the has

Re: Hash table element existence check

2016-09-03 Thread Illuminati via Digitalmars-d-learn
On Friday, 2 September 2016 at 19:48:30 UTC, Steven Schveighoffer wrote: 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

Re: Hash table element existence check

2016-09-03 Thread Basile B. via Digitalmars-d-learn
On Friday, 2 September 2016 at 19:38:34 UTC, 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. I could keep a bitarray, but wasting around 12% space. I could use pointers(null check) to elements

Re: Hash table element existence check

2016-09-03 Thread Cauterite via Digitalmars-d-learn
On Friday, 2 September 2016 at 19:38:34 UTC, 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. Just do a regular lookup on the hash? It's an O(1) operation, like 4 instructions.

Re: Hash table element existence check

2016-09-02 Thread Steven Schveighoffer via Digitalmars-d-learn
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 bitarra