Documentation ¶
Overview ¶
Trie implements a byte trie data structure. It is fast as it uses arrays instead of maps and no bound checks.
Index ¶
- type Trie
- func (t *Trie) All(prefix string) (int, []string)
- func (t *Trie) AllBytes(prefix []byte) (int, []string)
- func (t *Trie) Contains(word string) bool
- func (t *Trie) Insert(word string)
- func (t *Trie) IsLeaf() bool
- func (t *Trie) IsValid() bool
- func (t *Trie) Prefix(word string) *Trie
- func (t *Trie) PrefixAll(prefix string) (int, []string)
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
}
func (*Trie) All ¶
All returns all the valid words from that point onwards. Typically called from the result of [Prefix]. if somehow both 0 and 255 are valid yet not much in between, the optimization of min,max range won't do much, but for normal words, it should help a lot. Returns the len of the longest common prefix. If the input is incomplete UTF-8 sequence, use AllBytes() instead.
Click to show internal directories.
Click to hide internal directories.