Trie
Example:
Public Methods
| Return | Name | Description |
|---|---|---|
void | insert | Insert a word into the trie. |
bool | search const | Search for exact word. |
std::vector< std::string > | starts_with const | Find all words starting with prefix. |
insert
inline
Parameters
wWord to insert (ASCII characters)
search
const
Parameters
wWord to search for
Returns
true if word exists in triestarts_with
const
Parameters
prefixPrefix to search for
Returns
Vector of all words starting with prefix Returns empty vector if prefix not foundPrivate Attributes
| Return | Name | Description |
|---|---|---|
Node | root_ | Root node. |
root_
Private Methods
| Return | Name | Description |
|---|---|---|
void | collect const | Collect all words with given prefix. |
collect
const