Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 Trie::complete(string) this function should return a C++ vector of strings containing all of the words in the dictionary that begin with the given input string. For each word found in the trie, there will be one value in the vector. If no matching words are found, the function should return an empty 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago