Documentation ¶
Overview ¶
Package trie provides a character-based prefix trie data structure for storing arbitrary payloads in an efficiently retrievable manner.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Trie ¶
type Trie struct {
// contains filtered or unexported fields
}
Trie stores data at given strings in tree structure, for linear-time retrieval. Call New() to obtain a valid Trie.
func (*Trie) FindPrefixes ¶
FindPrefixes invokes the Visitor with all key-value pairs where the key is a prefix of `key`, including exact matches. It does this in increasing order of key length, and terminates early if Visitor returns false.
func (*Trie) FindSuffixes ¶
FindSuffixes invokes the Visitor with all key-value pairs where the key is prefixed by `key`, including exact matches. It does this in an unspecified order, and terminates early if the Visitor returns false.
Invoking FindSuffixes with the empty string as a key will iterate over all values.