Question: Write a program that reads in the following keys from keyboard and stores the individual words as keys in a string R-way tri (R=256). It

Write a program that reads in the following keys from keyboard and stores the individual words as keys in a string R-way tri (R=256).

It was the best of times, yet it was unpleasant times, there should be a wisdom, if not, it must have been the age of foolishness.

The value in the nodes of the tri will store the number of occurrences of the corresponding keys. Do not use a counter to count the number of times you read a given word from the file, instead your program should be intelligent enough to keep record of the number of occurrences. Ignore case and punctuation. Test your program using the following example code.

if (trieObj.contains("was"))

cout << "was repeated " << wli.get("was") << " times." << endl;

else

cout << "does not contain was" << endl;

cout << endl;

if (trieObj.contains("worst"))

cout << "worst repeated " << wli.get("worst") << " times." << endl;

else

cout << "does not contain worst" << endl;

cout << endl;

if (trieObj.contains("foolish"))

cout << "foolish repeated " << wli.get("foolish") << " times." << endl;

else

cout << "does not contain foolish" << endl;

cout << endl;

cout << "End of test! ";

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!