Skip to content

An implementation of minimal perfect hash function generation as described in Czech et. al. 1992.

License

Notifications You must be signed in to change notification settings

soundcloud/MinimalPerfectHashes.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimal Perfect Hashes

Build Status

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.

Requirements

Using MinimalPerfectHashes.jl requires that the following software be installed:

  • Julia — The Julia language itself.
  • Graphs.jl — Julia's graphs package, version 0.2.4 or greater.

Installation

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

Support

You can check for @mweiden on the #julia IRC channel on Freenode.

Metadata

About

An implementation of minimal perfect hash function generation as described in Czech et. al. 1992.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages