CS 330: Algorithms: Design & Practice

Homework2: Finding Anagrams
Due: In class on Monday, February 6, 2012

Presentations by: AAA & BBB

Assignment:

Use the files in ~dblank/cs330/Homework2/ (specifically sign.c and squash.c from the book) to find anagrams.

Use the code as described in Section 2.8 to find all anagrams in the dictionary file /usr/share/dict/words

The dictionary file contains over 450,000 words. Use the Unix command 'wc' to find out how many words exactly. The words listed in the dictionary may have punctuations and capitalized letters. You will have to remove all punctuations and capital letters prior to looking for anagram classes.

Turn in:

  1. A listing of the anagram classes found. In a file of nearly 1/2 million words you are guaranteed to find many anagrams. How many are there?
  2. Do all of the following:
  3. A written description (in your own words) as to how the algorithm works.

Extra Credit:

Translate the code into another language of your choice.

Presentation:

AAA & BBB will give a presentation on this exercise in class on Monday, February 6. Your presentation should include a description of the problem and the overall solution. It should also include all the other things you had to do in the implementation process (things that were not addressed in the solution in Section 2.8). You may also want to try and look for other dictionaries or text files (for example, see Project Gutenberg) to search for interesting anagrams (when you do this, you may want to restrict yourself to word sizes larger than 6 letters).


Back to CS330 Materials