Question
need help with this c++ project. need to implement an alphabet trie data structure, and to use this data structure to write an autocomplete program.
need help with this c++ project.
need to implement an alphabet trie data structure, and to use this data structure to write an autocomplete program.
In order to implement your autocomplete program, you will need to create a trie data structure (class Trie) to facilitate efficient word searches from an English dictionary.
bool Trie::insert(string) Insert a new word into the trie. Duplicate words are not allowed. This function should return true if the word is successfully inserted into the trie, and false if the word could not be inserted (for example, due to a duplicate word already found in the trie).
int Trie::count() return the number of words in the trie
int Trie::getSize() return the total number of nodes in the trie
bool Trie::find(string) if the given word is found in the AVL tree, this function should return true, otherwise this function should return false
int Trie::completeCount(string) this function should return the number of words in the dictionary that begin with the given input string. If no matching words are found, the function should return zero.
vector
Example: The call resultVector = myTrie.complete("addr") were called on a trie built with the wordlist.txt file provided with this project should return a vector containing the strings: {"address", "addressable", "addressed", "addressee", "addressees", "addresses", "addressing"}.
this is what the output should look like:
*******
Please enter a word prefix (or press enter to exit): addr There are 7 completions for the prefix 'addr'. Show completions? Yes Completions ----------- address addressable addressed addressee addressees addresses addressing Please enter a word prefix (or press enter to exit):
**************
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started