Documentation ¶
Overview ¶
Effecient Trie data structure implementation using a map.
It can store all UTF-8 characters in runes as supported in golang.package trie
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 holds the data in a prefix tree using an unordered map
func (*Trie) Insert ¶
Insert one or more words into the Tri.
Insertion is O(m) where m is the number of letters in the word.
func (*Trie) SortedWords ¶
Returns a slice of words sorted alphabetically
func (*Trie) Suggestions ¶
Returns a slice of words matching query from the trie. Worst case: O(m+n) where m is the number of characters in query and n is the number of nodes in the trie.
Click to show internal directories.
Click to hide internal directories.