|
Bill Teter email: william.teter@plattsburgh.edu |
|
|
Lab 13 Sets and permutations and a dynamic linked sorted list In this lab you will do two projects. The first is to write a program
called Anagram which has a single command line argument. The argument will
be a string. Your program will print all the permutations of that string
that are English words found in the file /usr/share/dict/words. My public
directory, The Anagram program should read in the words file into a HashSet. Use the HashSet constructor that allows you to set the initial size so that the underlying array is not more than 75% full. Notice that if the command line argument string contains multiple letters then each anagram for that string appears twice in the output. For example the anagrams of "that" will print "that" twice because of the two t's. Improve the Permutations class by having its iterator avoid duplicates by using a set instead of a list. The second project involves a dynamic linked sorted list. Call the class SortedLinkedList, make the class generic on a Comparable type and implement the following methods: public int size() public boolean add(AT x) public AT get(int i) I have a test program in my public directory for testing your SortedLinkedList class called TestStrings.java. |