https://github.com/s0rg/trie
Generic prefix tree for golang
https://github.com/s0rg/trie
data-structures golang-library prefix-tree trie trie-structure
Last synced: 5 months ago
JSON representation
Generic prefix tree for golang
- Host: GitHub
- URL: https://github.com/s0rg/trie
- Owner: s0rg
- License: mit
- Created: 2022-08-07T16:01:15.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2025-04-25T11:10:00.000Z (5 months ago)
- Last Synced: 2025-04-25T12:23:04.672Z (5 months ago)
- Topics: data-structures, golang-library, prefix-tree, trie, trie-structure
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 13
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://pkg.go.dev/github.com/s0rg/trie)
[](https://github.com/s0rg/trie/blob/main/LICENSE)
[](go.mod)
[](https://github.com/s0rg/trie/tags)[](https://github.com/s0rg/trie/actions?query=workflow%3Aci)
[](https://qlty.sh/gh/s0rg/projects/trie)
[](https://qlty.sh/gh/s0rg/projects/trie)
[](https://goreportcard.com/report/github.com/s0rg/trie)# trie
Generic prefix tree for golang
# example
```go
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
}
```