Perfect
A perfect minimal hash function generator
Install / Use
/learn @mixu/PerfectREADME
perfect
A perfect minimal hash function generator
A perfect hash function for a set S is a hash function that maps distinct elements in S to a set of integers, with no collisions.
A minimal perfect hash function also yields a compact hash table, without any vacant slots.
http://en.wikipedia.org/wiki/Perfect_hash_function
The generator here is a port of Steve Hanov's perfect minimal hash generator.
Installing
npm install --save perfect
Usage example
var perfect = require('perfect');
var dict = { a: 'a', b: 'b', c: 'c', d: 'd' },
tables = perfect.create(dict);
Object.keys(dict).forEach(function(key) {
console.log('key: ' + key + ' value: ' + perfect.lookup( tables[0], tables[1], key));
});
Related Skills
node-connect
342.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.7kCommit, push, and open a PR
