CSC517: Data Structures and Algorithm Analysis - Spring 2004
Professor Christian A. Duncan
csc517@mail.cs.miami.edu


Office Hours

Resources

Course Information

Exams
Midterm: Thursday, March 11
Final: Section P, Thursday, May 6 (11:00 - 1:30)
(FYI, to see all Final Exam Schedules for Spring 2004, click here)

Course Notes (most likely very few will be provided, unfortunately)

Homework (and Reading) Assignments

CSC402 Practicum Information

Submission Instructions

Homework (and Reading) Assignments for CSC402 Practicum

  1. Program 1: Due Tuesday, February 3 (midnight)
    Extended: Thursday, February 5 (midnight)
    Read 1.6 and 2.6
    Do P-1.2
  2. Program 2: Due Tuesday, February 24 (midnight)
    Read 3.6
    Do P-3.1
    Note: Read submission instructions. You may choose any of the three types of structures to implement. You should also provide an interface to interact with the dictionary, either graphical or text-based. There should also be a function to display the tree (for grading and debugging purposes). Displaying a tree can be done in ASCII (sideways view) or graphically. Be sure to submit a README file explaining all the details including which structure you implemented, which methods you implemented, how to compile and run the program, and how the interface works. If you have trouble printing a binary tree in ASCII nicely, let me know and I'll post an example or pseudocode, but try first.
  3. Program 3: Due Tuesday, April 13 (midnight)
    Do P-5.2
    Note: There is a lot of leeway in the "interface" of this assignment (as with all of these higher-level programs). But, be sure to do the following:
  4. Program 4: Due Tuesday, April 27 (midnight)
    Do P-7.2
    Note: As before, there is a lot of leeway in the "interface" of this assignment. You should use the same logic as previous examples. Allow ways for the grader to enter input and test the correctness and performance of your algorithm.
  5. Program 5: Due Tuesday, May 11 (midnight)
    Do P-9.2
    This is your "final exam" for the course. Basically, you should write two programs. One that compresses a text file - and saves it in a new (likely binary) file. The other decompresses the compressed file. Here are two potential runnings of the code in either C/C++ (executable) or Java:
    % hzip foo.txt foo.txt.hz
    HZIP Version 0.1: Compressed foo.txt to foo.txt.hz
    % hunzip foo.txt.hz foo2.txt
    HUNZIP Version 0.1: Uncompressed foo.txt.hz to foo2.txt
    
    % java Hzip foo.txt foo.txt.hz
    HZIP Version 0.1: Compressed foo.txt to foo.txt.hz
    % java Hunzip foo.txt.hz foo2.txt
    HUNZIP Version 0.1: Uncompressed foo.txt.hz to foo2.txt
    
    Notice that foo.txt and foo2.txt should be identical and the compressed (foo.txt.hz) file should certainly (or typically) be significantly smaller in size.

    Helpful Tip: To do this, you obviously need to write BITs to a file and not just bytes. To make this space efficient, you need to be careful about how it is written. I am providing a simple Java code class that let's you read bits from a stream and another that lets you write bits to a stream as well as a sample class illustrating how they are used. It is by no means perfect as I don't provide every check needed. In particular, it will read until EOF which has to be on a byte alignment. So, if your compressed code has bits that aren't a multiple of 8 (most likely) you will be writing a few extra bits. This is unavoidable (in fact, you'll also be using a whole block more than needed as that is how files are stored). That is not the problem. The trick is when reading the file back to know when the end of compression occurs. The best way - near the beginning indicate the number of bits to read, or characters to read, or something along that line. Store that as an integer value - just a sequence of 16 bits.

    Here is the sample code