Assignment 10
- Due Jul 26, 2017 by 11:59pm
- Points 5
- Submitting a file upload
An anagram of a word is a word formed by rearranging the letters of the first word. For example, we can use the letters of iceman to spell cinema.
There are many words that have multiple anagrams: "beats" has 6 listed in our dictionary.
['abets', 'baste', 'bates', 'beast', 'beats', 'betas', 'tabes']
Write a program that will mine our dictionary words.txt for anagrams. There are several ways to do this, and some of them take much longer than others. You might want to practice with the initial parts of words.txt. I used the first 10,000 words, and found all but the last word in the list above.
Hint: Start by writing a routine that takes two words and decides if they are anagrams of each other.
Hint: How can you tell quickly if two words are anagrams?
Hint: Dictionaries allow you to find a key quickly. What key would be most useful for your search?
What to hand in: Hand in your program, and tell us the 10 largest sets of anagrams you find, and the time your program takes to run.