##Minimal Perfect Hashes
A Julia module for generating minimal perfect hash functions for an array of strings:
julia> using MinimalPerfectHashes
julia> months = ["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"]
julia> mph = MinimalPerfectHash(months)
julia> results = map((x) -> hash(x, mph), months)
12-element Int64 Array:
1
2
3
4
5
6
5
8
9
10
11
12
This is great for creating memory efficient lookup tables with an O(1) access time.
Using MinimalPerfectHashes.jl requires that the following software be installed:
MinimalPerfectHashes.jl should be available from METADATA.jl. To install MinimalPerfectHashes.jl, use the following:
Pkg.add("MinimalPerfectHashes")
If this does not work, git clone the repository in your ~/.julia/
directory.
MinimalPerfectHashes.jl has one main module named MinimalPerfectHashes
. You can load it as:
using MinimalPerfectHashes
You can check for @mweiden on the #julia IRC channel on Freenode.
- Owner: Matt Weiden, SoundCloud Ltd.
- Status: Research/prototyping