Property | Type | Description | |
---|---|---|---|
AddWord | void | ||
GetCount | void | ||
GetLongestWords | void | ||
GetShortestWords | void | ||
GetTrieNode | |||
GetTrieNodesStack | Stack |
||
GetWords | void | ||
RemovePrefix | void | ||
RemoveWord | int | ||
Trie | System | ||
Trim | void |
Method | Description | |
---|---|---|
AddWord ( string word ) : void |
Add a word to the Trie.
|
|
Clear ( ) : void |
Clear all words from the Trie.
|
|
Count ( ) : int |
Get total word count in the Trie.
|
|
GetLongestWords ( ) : ICollection |
Get longest words from the Trie.
|
|
GetShortestWords ( ) : ICollection |
Get shortest words from the Trie.
|
|
GetWords ( ) : ICollection |
Get all words in the Trie.
|
|
GetWords ( string prefix ) : ICollection |
Get words for given prefix.
|
|
HasWord ( string word ) : bool |
Returns true or false if the word is present in the Trie.
|
|
RemovePrefix ( string prefix ) : void |
Remove words by prefix from the Trie.
|
|
RemoveWord ( string word ) : int |
Remove word from the Trie.
|
|
UniqueCount ( ) : int |
Get unique word count in the Trie.
|
|
WordCount ( string word ) : int |
Returns the count for the word in the Trie.
|
Method | Description | |
---|---|---|
AddWord ( |
Recursive method to add word. Gets the first char of the word, creates the child TrieNode if null, and recurses with the first char removed from the word. If the word length is 0, return.
|
|
GetCount ( |
Get word count in the Trie.
|
|
GetLongestWords ( |
Recursive method to get longest words starting from given TrieNode.
|
|
GetShortestWords ( |
Recursive method to get shortest words starting from given TrieNode.
|
|
GetTrieNode ( string prefix ) : |
Get the equivalent TrieNode in the Trie for given prefix. If prefix not present, then return null.
|
|
GetTrieNodesStack ( string s, bool isWord = true ) : Stack |
Get stack of trieNodes for given string.
|
|
GetWords ( |
Recursive method to get all the words starting from given TrieNode.
|
|
RemovePrefix ( Stack |
Remove prefix and trim.
|
|
RemoveWord ( Stack |
Remove word and trim.
|
|
Trie ( ) : System |
Create a new Trie instance.
|
|
Trim ( Stack |
Removes unneeded trieNodes going up from a trieNode to root. TrieNode, except root, that is not a word or has no children can be removed. |
public GetWords ( string prefix ) : ICollection |
||
prefix | string | |
return | ICollection |