Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data Structures in Java Programming Problem Autocompletion via Tries Write a program that prompts the user for the beginning of a word and outputs all

Data Structures in Java Programming Problem

Autocompletion via Tries

Write a program that prompts the user for the beginning of a word and outputs all the possible words that can complete what the user typed in alphabetical order. For example, one possible user interaction would be:

$ java AutoCompleter dictionary.txt

Loading Dictonary. Standby...

Dictionary loaded!

Start typing a word and hit enter (quit! to end)

algori

Possible completions:

algorithm

algorithmic

Perform the autocompletion lookup by storing a dictionary of words in a trie. Load the dictionary when your program starts from a text file of words. Use the included Scrabble dictionary file TWL06.txt1 . Write your own MyTrie class for Strings that performs insertions, lookup and preorder toString() conversion (no deletion is necessary). At the cost of memory usage, simplify your code by storing the full word at each leaf. The lookup method should take the beginning of a word input string and return the sub-trie of words that start with the input string. Calling toString() on this sub-trie should return the desired output (i.e., put the newlines in the string conversion to create the kind of output in the above example).

TWL06.txt1 can be found on the weblink: http://www1.cs.columbia.edu/~bert/courses/3134/hw3/TWL06.txt

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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions

Question

What is liquidation ?

Answered: 1 week ago

Question

Explain the different types of Mergers.

Answered: 1 week ago

Question

What is dividend payout ratio ?

Answered: 1 week ago

Question

7. What is coaching? Is there only one type of coaching? Explain.

Answered: 1 week ago