

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


DUE DATE: NOON on Monday, July 7th, 2008 with a 3 hour grace period.
I know we are all fascinated by the works of William Shakespeare. The homework is to study two ways to solve the same problem – finding the frequency of occurrence of each word the playwright used in a given passage.
Eventually, we will provide a test program that will read in arbitrarily large amounts of Shakespeare text. A typical example is attached to this assignment as Mercy.txt. What we want is a printout of all the words used in the passage in alphabetical order without listing duplicated words more than once, but with the number of times each word occurs in the given text.
You will be required to solve this problem two ways: first using the built-in LinkedList class, and second by inserting each word as a String into a BST.
Infrastructure
You will need to write a Word class that contains a String named ‘word’ and an int named ‘frequency’ and extends Comparable. For convenience, the data can be public. It will need:
LinkedList Approach
You will need to write the LLShakespeare class with the following capabilities:
class.] The delimiters for the tokenizer should include all known punctuation except the apostrophe (‘).
BST Approach
To your horror, you discover that when you put large amounts of text into your analysis, it runs much too slowly. You have to re-implement your analysis (keeping most of it intact) using a BST of Word objects instead of your LinkedList
Remember, if you find the string already in the tree, you should increment the word’s frequency.
Requirements:
How to Turn In
Turn in only the following files via TSquare: