COMP2000 Assignment 1 Anagrams solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

An anagram is a word or phrase formed by rearranging the letters of another word or phrase. Some examples are:

Resist = Sister Recitals = Articles
Timetable = Bet I’m Late A Gentleman = Elegant Man
A Telephone Girl = Repeating “Hello” Tom Cruise = So I’m Cuter
Western Union = No Wire Unsent A Decimal Point = I’m a Dot in Place
Eleven plus two = Twelve plus one Election Results = Lies, Let’s Recount!

An input file contains one word or phrase per line. Write a program to read the file and output all words/phrases (from the file) that are anagrams of each other. Print a blank line between each group of anagrams.

Your program must use a binary search tree in some meaningful way. Extra credit will be given for output arranged in some meaningful order.

Sample input Sample output

repaint astronomers
timetable No more stars
mother-in-law
Presbyterians Bet I’m Late
painter timetable
Clint Eastwood
pertain Britney Spears
Britney Spears Presbyterians
Bet I’m Late
No more stars Clint Eastwood
Woman Hitler Old West Action
astronomers
Old West Action mother-in-law
Woman Hitler

painter
pertain
repaint