Skip to content

Instantly share code, notes, and snippets.

View jameshfisher's full-sized avatar
🏠
Working from home

Jim Fisher jameshfisher

🏠
Working from home
View GitHub Profile
@jameshfisher
jameshfisher / pearson.go
Created May 18, 2010 22:31
A Go implementation of Pearson hashing
package pearson
/* Get an initial hash value by passing in the length of the array. */
func Init(length int) (hash byte) { return byte(length % 256) }
/* Given the hash of a string S0..SN and the character SN+1,
get the hash of the string S0..SN+1.
*/
func FeedByte(oldhash byte, next byte) (newhash byte) {
/* The following table is the result of the pseudorandom order at
@jameshfisher
jameshfisher / trie.go
Created May 15, 2010 19:05
A trie structure, storing []byte elements, implemented in Go
package trie
import (
"container/vector"
"sort"
)
// A 'set' structure, that can hold []byte objects.
// For any one []byte instance, it is either in the set or not.
type Trie struct {