CSCI 221
HOMEWORK ASSIGNMENT #4
Assigned Date: Monday, April 11, 2005 (sec 2 +1 day)
Due Date: Monday, April 25, 2005 (sec 2 +1 day)

 

Purpose:

This assignment focuses on linked lists.

 

Assignment: 

Implement the TextAnalyzer ADT in Java.  This ADT encapsulates a list of items stored using a sorted doubly-linked list with dummy head and tail nodes. The list contains unique words sorted lexicographically (case insensitive) and corresponding counts.  Adding a duplicate word simply increments the corresponding count.  Deleting a word, decrements the corresponding count.  Deleting the last instance of a word, completely removes that word (and corresponding count) from the list.

In terms of implementation, TextAnalyzer objects should have three Node references, head, tail, and currentPosition.  There should NOT be a numItems (or similar) variable, i.e., the length of the list will be calculated dynamically whenever it is needed.

Class Node should be implemented as an internal class.  It should encapsulate a word and a count, as well as a prev and next link. 

TextAnalyzer has the following API:

 

In addition to the above, ADT TextAnalyzer provides the following operations:

 

To calculate the Zipfian distribution use ZipfStatistics.class.  Download it and save it in the same directory as your source file.  It contains the following methods:

 ZipfStatistics.class is made available under a Creative Commons License.  It was developed by Chris Wagner, Charles McCormick, and Bill Manaris.

 

Documentation:

See first assignment.  Also you should submit a javadoc API in HTML for your ADT.  Your code should be fully documented.

 

Submission:

Two options (use either one – the effect is the same):

  1. Open your BlueJ project.  Under the Project menu, click Create Jar File… .  In the dialog box that opens, select Include Source, and press Continue.  Email the generated .jar file to manaris@cs.cofc.edu, by the due date and time.
  2. (This option is available in BlueJ 2.0 and above)  Save submission.defs into your BlueJ project directory.  Open your BlueJ project.  Under the Tools menu, click Submit… .  In the dialog box that opens, select scheme CSCI 221/hmwk4 and press Submit.  (You may have to specify your email information.)

 

Notes:

  1. You should modularize and document your code thoroughly. Your methods should be fully documented, i.e., purpose, and pre/postconditions.  Each Java file should have a certificate of authenticity, as per first homework.