A Trie is a tree for efficient storing and retrieval of strings such as words in a dictionary. They are useful for checking all the strings that have a common prefix. Insertions, lookups and removals in O(s) where s is the search term.
O(s)
s
Trie
Optional
Generates all results that start with the given string.
A prefix string
The number of results to return.
Returns the total number of strings in the tree.
Adds the given string to the tree.
A string
Removes all strings from the tree.
Returns true if the given string is found in the tree.
true
Check if there are no items.
true if is empty.
Removes the given string from the tree.
Returns true if the string was found and removed.
The string to remove
Generated using TypeDoc
A Trie is a tree for efficient storing and retrieval of strings such as words in a dictionary. They are useful for checking all the strings that have a common prefix. Insertions, lookups and removals in
O(s)
wheres
is the search term.See
Trie