[SOLVED] COMP 2000 Assignment 4 Solved 

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment-4-gj5ojh.zip (54.9 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (1 vote)

 

Write a program to read and store a thesaurus as follows.

Data for the program consists of lines of input.  Each line contains a (variable) number of distinct words, all of which are synonyms.  You may assume that words consist of letters only and are separated by one or more blanks. The data structure must be organized such that, given any word, all synonyms for that word can be quickly found.  A word can appear on more than one line. If a word appears on more than one line then all words on those lines are to be considered synonyms.

After the complete thesaurus has been built, print an alphabetical listing of the words and their synonyms.

Print another alphabetical listing but, this time, each word is printed once only.  That is, if a word is already printed as a synonym of another word then it does not appear in the listing again.

Sample input

blossom flower

bewilder confound confuse perplex

dwell live reside

Sample output

Words                Synonyms

bewilder             confound confuse perplex

blossom              flower

confound             bewilder confuse perplex

confuse              bewilder confound perplex

dwell                live reside

flower               blossom

live                 dwell reside

perplex              bewilder confound confuse

reside               dwell live

 

 

Words                Synonyms

 

bewilder             confound confuse perplex

blossom              flower

dwell                live reside

 

 

  • Assignment-4-gj5ojh.zip