How linked lists work in the book

Assignment Help Data Structure & Algorithms
Reference no: EM131963712

Assignment: 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:

? A linked list in MyLinkedList that implements interface . You'll be using in two different ways, to store a list of and to store a list of within each object. More on this below.

? Code in the main method of that takes lines that have been read from a rhyming dictionary and stores them in the lists.

? A subclass of MyLinkedList called MySortedLinkedList , that has a method for adding items into the list in sorted order.

? Code in the main method of RhymingDict that takes pairs of words specified on the command line and outputs whether they rhyme or not.

A LinkedList is useful for storing information when you don't know how many items you need to store. In this lab, we will be iterating through a rhyming dictionary and storing words together according to their rhyming group, which is the most heavily emphasized part of their pronunciation.

In the directory of starter code for the assignment, you'll see a subdirectory called cmudict . Inside is a file called cmudict- short .dict. Opening this, you'll see lines like:

The letters after the words represent the phonemes (units of sound) you speak when you pronounce the word. The phonemes that have numbers after them (0, 1 or 2) are the emphasized phonemes, with phonemes marked with 2 having the most emphasis (say the words out loud to yourself to try this out). Two words rhyme if the share the same subset of phonemes after the most emphasized phoneme. For example:

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".

Attachment:- Assignment-Rhyming-Linked-List.rar

Reference no: EM131963712

Questions Cloud

Find the present value : Find the present value and explain whether or not you would invest in the project, if you are asked to pay $5, 500 to be able to participate.
How much does the equilibrium level of output? fall : If the consumption function is C? = 100? + 0.95Y and planned investment spending is 500?, what will be the equilibrium level of? output?
Discuss the bcp strategies discussed in the video : Research and provide your recommendations be for the Business Continuity Management Team (BCMT) for a University Library?
How much is the present value of the perpetual fee to bank : How much is the present value of the perpetual fee to the bank?
How linked lists work in the book : 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.
How much is the ear for this factor : The factors discount is 3%. How much is the EAR for this factor?
Research and recommend a cmp approach for a university : Research and find at least three (3) approaches for developing a CMP. Research and recommend a CMP approach for a University.
Determining the firm total cost : If the firm produces 450 boots, then the firm's total cost is more than $90,000t, true or false?
What is the estimated enterprise value of target : What is the estimated enterprise value of Target Inc. using the weighted average valuation approach?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Design an algorithm to determine best route for passenger

Consider the following problem: Design an algorithm to determine the best route for a subway passenger to take from one designated station to another in a typical urban subway system similar to those in San Francisco and New York

  Derive a set of relational tables from the er diagram

Outline the kinds of anomalies that can arise in the scenario given above by using un-normalized tables. Show how the table created in task 2 could be re-organised into separate tables to avoid anomalies

  Write a suitable logical description of the robot.

Write a sentence describing the Go action. Use a successor-state axiom.

  Is there a feasible solution for the problem

he running time of A on an input of size n is e(n log n). Given an input x of size n, give an algorithm that runs in time 0(n log2 n) and finds the cost of an optimal solution for x.

  You have been commissioned to prepare a manual covering the

in a 6-8-page paper complete the followingyou have been commissioned to create a manual covering the installation

  Distributed system algorithms

Distributed system algorithms - Leader Election (id),  In: Processor's id , Out: LEADER if processor has largest id, NOT_LEADER if otherwise

  List some of the attacks on the diffie-hellman key exchange

List some of the attacks on the Diffie-Hellman key exchange protocol we discussed in the lecture. Present your solution for avoiding such attacks.

  Write an array-returning method that takes a two-d array

Write an array-returning method that takes a two-dimensional array of ints as a parameter and returns a two-dimensional array of chars, assigning a letter grade corresponding to the integer grade (A if 90 or above, ..., F if less than 60).

  Perform a post order traversal of the bst

Refer to the following binary search tree:Perform a post order traversal of this BST.

  Write code to implement the expression

Write code to implement the expression: A= (B+C) * (D+E) on 3-, 2-, 1- and 0- address machines. In accordance with programming language practice, computing the expression should not change the values of its operands. Show all instructions.

  Implement the decision tree about car problem

Implement the decision tree about car problem found in the Lesson USING CLIPS TO MAKE A RULE BASED SYSTEM at the end of this module. Submit source code and 5 test cases in the drop box provided.

  Explain the huffman algorithm

Huffman's algorithm occasionally generates compressed files that are larger than the original. Prove that all compression algorithms must have this property.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd