Skip to content

s0rg/trie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PkgGoDev License Go Version Tag

CI Maintainability Code Coverage Go Report Card

trie

Generic prefix tree for golang

example

    import (
        "fmt"
        "log"

        "github.com/s0rg/trie"
    )

    func main() {
        t := trie.New[int]()

        t.Add("bar", 1)
        t.Add("baz", 2)
        t.Add("bat", 3)

        val, ok := t.Find("bar")
        if !ok {
            log.Fatal("not found")
        }

        fmt.Println(val) // will print 1
    }

About

Generic prefix tree for golang

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •