Documentation ¶
Overview ¶
Package trie provides an interface and implementations for the trie data structure
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Trie ¶
type Trie[T comparable] struct { // contains filtered or unexported fields }
Trie is a data structure for locating keys within a set but the key is broken into individual parts (e.g. a string broken into characters) and the key is access by traversing the trie depth-first.
func NewTrie ¶
func NewTrie[T comparable]() *Trie[T]
NewTrie instantiates a trie and returns a pointer to it.
func (*Trie[T]) Contains ¶
Contains returns a Boolean that is true if the given key exists in the trie.
type TrieNode ¶
type TrieNode[T comparable] struct { // contains filtered or unexported fields }
TrieNode is a node within the trie and contains a map of child nodes and a Boolean to say whether a key terminates at this node.
Click to show internal directories.
Click to hide internal directories.