0

I'm trying to implement a minimal perfect hash function, and one of the primary ways to to this is to be able to take the known universe of keys and split them into decently even buckets of a small size (the smaller the better within reason). The problem is I cant figure out how to distribute these byte arrays. The entire set of keys is available at the outset of the algorithm. Does anyone have any suggestions of what I could do?

Thanks!

Daniel Imberman
  • 618
  • 1
  • 5
  • 18
  • You can't just use https://www.gnu.org/software/gperf/ ? – aecolley Aug 27 '14 at 23:17
  • Interesting! Well I guess there's 2 minor problems I can see at the moment with this. 1. I'm working in java and 2. a perfect hash algorithm is not necessarily a minimal perfect hash algorithm. That being said I might be able to pull some info from the source code to help with my project! – Daniel Imberman Aug 27 '14 at 23:22
  • 1
    So update on #1 for anyone finding this thread later, here's a java version http://www.anarres.org/projects/jperf/. Thank you again @aecolley – Daniel Imberman Aug 27 '14 at 23:23
  • The easiest algorithm to go from a perfect hash to a minimal perfect hash is to use the former to make a hash map from keys to integers. Yes, this uses Theta(log n) bits per key, but we know that Omega(1) bits per key are necessary, and how long are your keys anyway? – David Eisenstat Aug 28 '14 at 00:20

0 Answers0