Skip to content

sbromberger/lpmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lpmap: linear probing hash tables in Go

This is a generic implementation of linear probing hash tables in Go.

Example:

type MyKey uint64

func (k MyKey) Hash uint64 {
    return k
}
    
func main() {
    h := lpmap.New[MyKey, string](10, 0.5)  // capacity of 10, with a max load factor of 0.5
    h.Set(MyKey(9), "nine")
    
    val, found := h.Get(MyKey(9))     // "nine", true
    val, found = h.Get(MyKey(1))      // nil, false
    h.Set(MyKey(9)) = "four"          // replace value
    h.Size()                          // 1
    success := h.Delete(MyKey(9))     // true
    h.Size()                          // 0

About

Linear probing hashmaps for Go

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages