COS 226 Programming Assignment 1 - Checklist


Preface: Since this is the very first assignment, let me take a few moments to discuss some general issues, before discussing specifics about assignment 1.

Please make sure that you are aware of our Collaboration Policy, as any violations will be taken seriously.

Click to see details about computer accounts or about how to submit your source code and readme file when complete.

Make sure that you are aware of our Late Policy. On this note, we want to make sure that you realize that these assignments will require a good deal of time. The final source code may not be that long but creating and debugging the code is a serious time commitment. Also please note that precepts are scheduled for Mondays and Tuesdays, however it would be a mistake to wait until after precept to start your assignments. You may be able to ask far more meaningful questions in precept if you already have worked on the program enough to know what the real difficult issues are.

Finally, a note about the readme file which you must turn in each week. Besides any problem specific information which is listed in each week's assignment or checklist, you should use this file to give the reader a high-level explanation of your source code and point to any thing unusual or notable about your program (such as extra credit or known bugs).


Checklist 1: Shellsorting a Linked List.

The following is a checklist which provides a summary of the assignment. This is meant only as a supplement; please read the original assignment description.

  • Frequently Asked Questions
  • Requirements
  • Possible Progress Steps

  • Frequently Asked Questions:
    (This is the only part of this checklist which will change during the week.)

    When we talk about the "number of comparisons" we specifically are interested in times when you compare one key to another key (we didn't intend to have you account for every time a line of your code does an exchange, for instance in loop controls).

    Below we say: "Make sure that a pass of your h-sort does not use more than a constant amount of auxiliary space or more than a constant times N time. (Note: h does not count as a constant...this is too much)." Note, your h-sort may do many passes. We are not requiring that your overall h-sort run in O(N) time.


    Requirements:
  • Functionality:
  • Your program should implement shellsort, as described in the assignment.
  • The input for your program should be integers. (the assignment descriptions refers to using characters or floats at different stages for debugging, however your final program should definitely expect integers).
  • You must use a singly-linked list representation
    Graders will will be looking at your code to make sure each node has only one pointer.
  • Your exchanges must actually rearrange nodes of your lists (you are not allowed to just overwrite the key manually).
  • Make sure that a pass of your h-sort does not use more than a constant amount of auxiliary space or more than a constant times N time. (Note: h does not count as a constant...this is too much).
    Graders will definately be checking this part of your code.
  • Input Format: We will test your programs by running "a.out < inputfile" on a unix system, for an inputfile which consists of integers separated by white space. Please note it should not matter whether the integers are separated by a single space, multiple spaces, or even newlines. (I read such a file with while(scanf(" %d",&newinteger)!=EOF) { } as a loop). Here is a sample inputfile which we might use.
  • Output Format:
  • Each time your sort finishes using a particular h-value, you should output the number of comparisons which were used during the h-sort. At the very end, output the overall number of comparisons used by your sort.
  • Each time your sort finishes using a particular h-value, you should call a routine which prints out the current list of integers. For efficiency, you may choose to comment out these calls in your final submission if you wish (so long as it is clear to the grader how to add them back in for testing your program).
  • readme: Besides providing details about your implementation which are not clear from the comments within your source code, your 'readme' file for this program should also contain:
  • A (brief) explanation of what led you to the eventual choice of your h-sequence.
  • The two dimensional table, as described in the assignment.
    (Note: although you will need to write a program to generate random input for your own testing, you do not need to submit the code.)

  • Possible Progress Steps: These are purely suggestions for how you might make progress. You do not have to follow these steps.
  • Write code to read the input and build a singly linked list
  • Write a routine to exchange two nodes of a linked list (does it work for all cases?)
  • Implement bubble sort on a linked list
  • Implement a routine for "bubble h-sort"
    (if your first implementation uses too much space or time, how can you improve it?)
  • Run experiments and pick a sequence of h values for shellsort

  • cos226 Home Page
    rs@cs.princeton.edu
    Last modified: February 6, 2001