Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I had posted this question before many times, but got wrong answers that had nothing to do with the question. If you do not know
I had posted this question before many times, but got wrong answers that had nothing to do with the question. If you do not know how to answer the question, then don't answer. I only have one more question remaining this month to ask, so please answer correctly.
This is to be written in JAVA. The question shows sample code in C++, but the final code should be written in Java 8. Please include screenshots of your input and output, which should match the ones in the question. Thank You!
For this assignment, you will implement a trie (prefix tree) and use it to solve a couple of problems. You will need to implement three class methods: lookup, which returns a boolean indicating whether the target was found; insert, which adds a string to the trie; and remove, which removes a string from the trie (really removes it, instead of just changing the flag). You will also need to implement additional functions: alphabetical, which prints the contents of the trie in alphabetical order; autocomplete, which prints alphabetically all possible words that can be formed by a prefix and k additional characters; and count, which prints the number of words in the trie. For example, in C++, the function headers and trie node would be the following
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