CS 313: Data Structures in Java

Autumn 2002

Assignment 6

Using Recursion and Search for Listing Anagrams:

Due Wednesdy November 6 before 11:30pm

For this assignment, you will create a program that takes a string from a user and lists all the anagrams that can be created from that string. An anagram is any ordering of the string's letters that produces a word.

Completing the assignment requires the creation of a dictionary in order to verify whether each letter-ordering is an English word. The dictionary is just a collection class (call it Dictionary.java) that holds a long list of English words read from a file (use the file words.txt). The dictionary must provide a method for checking if a string is a word in the dictionary. Because the dictionary is reasonably large, your method should use a binary search to efficiently search through the collection.

Completing the assignment also requires the use of a recursive method that systematically generates all possible word-orderings based on the given string. This method and its strategy will be discussed in class. The recursive method, the main method and any utility methods can all be declared as static and should be defined in a second class called Anagram.java.

Final Submission

Before the due date and time, you should submit the following file through the submission Web page: