Assignment 2: Linked Lists
In this assignment, you will be reading in words from a pronunciation dictionary to figure out which words rhyme with each other.
To do this, you will be implementing MyLinkedList and MySortedLinkedList. Besides the lectures in class, you can read much more about the code details of how linked lists work in the book on pages 249-268.
You’ll be implementing the following:
ListInterface
MyLinkedList
RhymeGroupWords
Strings
RhymeGroupWords
RhymingDict
dignitary D IH1 G N AH0 T EH2 R IY0
necessitate N AH0 S EH1 S AH0 T EY2 T
undue AH0 N D UW1
moderated M AA1 D ER0 EY2 T IH0 D
moderated M AA1 D ER0 EY2 T IH0 D
anticipated AE0 N T IH1 S AH0 P EY2 T IH0 D
both rhyme, and they both share EY2 T IH0 D starting with the most emphasized phoneme. The EY2 T IH0 D is called the rhyming group for these two words. You’ll be storing rhyming groups in a linked list of RhymeGroupWords , a class you’ve been provided in the starter code. Each object stores a string with the rhyme group and a list of words that share the rhyme group (a variable of type ). So you’ll be using linked lists in two different ways: to store a list of RhymeGroupWords , and, within each RhymeGroupWords object, to store a list of words.
RhymingDict
The file RhymingDict.java is provided for you. It already has the following:
RhymeGroupWords
getRhymeGroup(String line)
● A method
from the dictionary. For example IH0 D” ) returns
, which returns the rhyme group for a line
.
, which returns the word for a line from the dictionary.
ListInterface
getRhymeGroup( “moderated M AA1 D ER0 EY2 T
● A method For example,
“EY2 T IH0 D”
getWord(String line)
getWord( “moderated M AA1 D ER0 EY2 T IH0 D” )
returns
, which returns a S tring[] of all the lines from the
1. Use your implementation of MyLinkedList to create a linked list of RhymeGroupWords , one for each unique rhyme group you encounter (there are 8 unique rhyme groups in cmudict-short.dict ). Within each RhymeGroupWords you’ll store a MySortedLinkedList of words that share that rhyme group.
2. Iterate through pairs of arguments to RhymingDict and use your linked list to determine if the pair of words rhyme. For example, with the command:
java RhymingDict crumbling mumbling collections abbreviated vegetate mutate
the output would be:
In the case of the last pair of words, and , since the word
doesn’t appear in cmudict-short.dict , it reports that and ignores “vegetate” . If an odd number of words is passed on the command line, it ignores the last word (since it’s not part of a pair).
Do not use built-in Java data structures (like ArrayList or LinkedList) in this file
“moderated”
. pronunciation dictionary.
loadDictionary()
● A method
The tasks you have to do is marked with the comment TODO in the main method of
EY2 T IH0 D
RhymingDict . These tasks are:
crumbling and mumbling rhyme
collections and abbreviated don't rhyme
mutate is not in the dictionary
“vegetate”
“mutate”
“mutate”
Grading
The points for this assignment are allocated as follows:
MyLinkedList
RhymeGroupWords
● ● ● ●
● ●
– described above
– specifies the methods you need to implement in
– an empty class file that implements
– an empty class file that extends .
Comments in the file specify what the one method and one method override should be RhymeGroupWords.java -aclassforstoringarhymegroupandthelistofwordsthat share that rhyme group (described above)
RhymingDict.java
ListInterface.java
MyLinkedList.java
MySortedLinkedList.java
ListIndexOutOfBoundsException.java
out of bounds in .
Turning the code in
● Create a directory with the following name: <student ID>_assignment2 where you replace <student ID> with your actual student ID. For example, if your student ID is 1234567, then the directory name is 1234567 _assignment1 .
MyLinkedList
– an exception to throw when a list index is
MyLinkedList
ListInterface
MyLinkedList
RhymingDict.java
MySortedLinkedList.java
MySortedLinkedList
EH2 R IY0: (adversary, apothecary, arbitrary, banbury, blackberry,
canterbury, cemetery, commentary, confectionery, constabulary, culinary,
customary, depositary, dictionary, dietary, dignitary, disciplinary,
discretionary, dromedary, dubarry, dysentery, emissary, estuary, feb,
february, functionary, gooseberry, hereditary, honorary, itinerary,
january, judiciary, legendary, literary, luminary, mercenary, military,
missionary, momentary, monastery, monetary, mortuary, mulberry, necessary,
obituary, ordinary, pecuniary, primary, proprietary, reactionary, rosemary,
salutary, sanitary, savagery, secondary, secretary, sedentary, seminary,
solitary, stationary, stationery, statuary, strawberry, temporary,
tributary, unnecessary, unsanitary, veterinary, visionary, vocabulary,
westbury)
EY2 T: (abdicate, abrogate, accelerate, accommodate, accumulate, aggravate,
alienate, alleviate, amalgamate, ameliorate, amputate, annihilate,
anticipate, arbitrate, arrogate, aspirate, assassinate, assimilate,
captivate, carbonate, checkmate, circulate, commemorate, commiserate,
communicate, compensate, complicate, concentrate, congregate, consecrate,
consolidate, contaminate, contemplate, cooperate, corroborate, culminate,
cultivate, decapitate, decorate, dedicate, delegate, delineate,
demonstrate, denominate, depopulate, depreciate, designate, deteriorate,
determinate, devastate, deviate, discriminate, disintegrate, disseminate,
dissipate, educate, elevate, elucidate, emanate, emancipate, emigrate,
enumerate, evacuate, exasperate, excavate, expiate, extenuate, exterminate,
extirpate, extricate, facilitate, fascinate, felicitate, flagellate,
fluctuate, generate, gravitate, hesitate, humiliate, hundredweight,
illustrate, imitate, immolate, implicate, inculcate, indicate, inmate,
instigate, isolate, legislate, locate, lubricate, magistrate, mandate,
mediate, meditate, migrate, militate, mitigate, mutilate, narrate,
navigate, necessitate, negotiate, nitrate, obliterate, obviate, officiate,
operate, originate, overstate, paperweight, participate, penetrate,
perforate, permeate, perpetuate, playmate, pontificate, precipitate,
predominate, premeditate, primate, probate, procrastinate, profligate,
propagate, punctuate, recreate, recuperate, regenerate, regulate,
reiterate, repudiate, retaliate, rotate, ruminate, saturate, schoolmate,
segregate, separate, shipmate, situate, stagnate, stimulate, stipulate,
subjugate, sulphate, terminate, underestimate, undulate, vacillate,
vegetate, venerate, vertebrate, vitiate)
UW1: (accrue, adieu, ado, anew, askew, bamboo, bleu, blew, blue, boo, brew, canoe, chew, cou, coup, crew, crewe, cue, debut, deux, dew, doo, drew, du, due, ensue, ewe, few, flew, flue, glue, goo, grew, gu, gue, hew, hoo, hu, hue, jew, jus, kew, knew, ku, misconstrue, moo, new , nu, ooh, ou, peru, pew, phew, pooh, pursue, q, qu, que, queue, revue, rue, shampoo, shew, shoe, shoo, sioux, slew, stew, strew, su, subdue, sue, taboo, threw, through, to, too, true , two, u, undo, undue, untrue, view, vous, vue, whew, who, withdrew, woo, you, zoo)
EY2 T IH0 D: (abbreviated, abdicated, abrogated, accelerated, accentuated,
accommodated, accumulated, adulterated, advocated, aggravated, aggregated,
agitated, alienated, alleviated, amalgamated, ameliorated, amputated,
animated, annihilated, anticipated, antiquated, appreciated, appropriated,
articulated, asphyxiated, assassinated, assimilated, associated,
attenuated, bifurcated, calculated, capitulated, captivated, castrated,
celebrated, circulated, collaborated, commemorated, communicated,
concentrated, congratulated, congregated, consecrated, contaminated,
contemplated, corroborated, corrugated, cultivated, debilitated, decimated,
degenerated, deliberated, delineated, demonstrated, denominated,
depreciated, designated, deteriorated, devastated, deviated, dilapidated,
discriminated, dissipated, duplicated, educated, elevated, eliminated,
emanated, emancipated, emigrated, emulated, enumerated, enunciated,
eradicated, exasperated, excavated, excoriated, exonerated, exterminated,
facilitated, gravitated, hesitated, humiliated, imitated, implicated,
inaugurated, infiltrated, intimated, inundated, irrigated, manipulated,
migrated, miscalculated, moderated, narrated, navigated, obligated,
obliterated, opinionated, outdated, oxygenated, participated, penetrated,
perforated, permeated, perpetrated, perpetuated, populated, precipitated,
predominated, premeditated, procrastinated, promulgated, propagated,
radiated, reciprocated, recuperated, regenerated, regulated, reiterated,
rejuvenated, relegated, renovated, repudiated, resuscitated, retaliated,
reverberated, ruminated, saturated, segregated, separated, serrated,
simulated, situated, sophisticated, speculated, stimulated, stipulated,
subjugated, subordinated, substantiated, suffocated, syncopated, tabulated,
tolerated, truncated, uneducated, unmitigated, venerated, ventilated)
EH1 N D IH0 NG: (amending, ascending, bending, blending, commending,
defending, depending, descending, ending, extending, lending, mending,
offending, pending, portending, pretending, rending, sending, spending,
suspending, tending, transcending, trending, unending, wending)
AH1 M B AH0 L IH0 NG: (crumbling, grumbling, humbling, mumbling, rumbling,
stumbling)
IY1 Z AH0 N AH0 B L IY0: (reasonably, unreasonably)
EH1 K SH AH0 N Z: (affections, collections, complexions, connexions,
corrections, elections, erections, objections, projections, protections,
reflections, rejections, sections)
crumbling and mumbling rhyme
collections and abbreviated don't rhyme
mutate is not in the dictionary
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more