-2

I'm trying to find an efficient C++ implementation of an hash table using open addressing. I've tried using https://github.com/sparsehash/sparsehash with no success.

In addition it would be a plus if : - the container would know that my hash method is guaranteed without collision. - the container had a constant-time method to access first free key.

Am I really looking for a hash table ? If yes, do you know such implementation ? If not, what would best suit my needs ?

Thx a lot, vob

Victor Drouin
  • 597
  • 2
  • 15

1 Answers1

0

You're looking for the phrase "perfect hashing." An code generator to create such a function is gperf: https://www.gnu.org/software/gperf/ Once you have that, you should implement your own hash table--perhaps you can start here: https://gist.github.com/jorendorff/b6afda0f5ae670b8ebb3

John Zwinck
  • 239,568
  • 38
  • 324
  • 436
  • I said my hash method is guaranteed without collision, I didn't say I need a new hash method u_u But if the table knows I guess it can optimize – Victor Drouin Aug 19 '17 at 06:00