Skip to content
Trie implementation in Go
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
trie.go
trie_test.go

README.md

Trie

Trie implementation in Go. Inspired by John Resig's trie-js.

Motivation

The trie data structure is particularly interresting to me as it's surprisingly simple yet powerful.

The data structure is nothing more than the recursive type type Node map[rune]Node. With this simple type we're able to index words by prefix and perform fast lookups.

Usage

import "github.com/alexkappa/trie"

t := trie.New()
t.Index([]string{"ab", "ac", "ad", "abc"})
t.Search("ab") // ["ab" "abc"]

The API documentation is available at godoc.org.

You can’t perform that action at this time.