CS302: Fundamental Algorithms

Laboratory Assignments

Fall 2006

CS302 home page Syllabus Schedule/Readings/Notes Lab Assignments TA Web Site Exams and Grading


  1. Information on general lab policy, late labs, cheating, and how to comment code can be found after the table of lab assignments (i.e., at the bottom of this page).
  2. Information about how to submit labs and hints can be found at the TA's website.


All labs are due at 23:59:59 on the due date.

Lab NameDue DateGrading GuideStatus
Lab 1 -- Stock Transactions Sept. 11grading guideAssigned
Lab 2 -- Golf Handicaps Sept. 25grading guideAssigned
Lab 3 -- Graphical Stock Charts Oct. 2 grading guideAssigned
Lab 4 -- Algorithm Analysis

       Lab 4 Solutions
Wed., Oct. 11 See lab writeupAssigned
Lab 5 -- Stock Reports Wed., Oct. 25 grading guideAssigned
Lab 6 -- Bank Simulation Nov. 13 grading guide Assigned
Lab 7 -- Grids Nov. 27 grading guide Assigned
Lab 8 -- Solving Mazes Tues., Dec. 5 grading guide Assigned


General Stuff

Lab attendance is not mandatory, although the TA will be taking attendance to track student participation. Borderline grades will be decided in part based upon the student's regular attendance in labs. The TA in charge may also give out information, or perhaps lecture a bit at the beginning of the lab. You are responsible for all material covered in labs. It is good to use that time to work on your labs since there is a TA available. The TAs will have office hours, but may be hostile if you are asking questions that you should have been asking in lab.


Cheating

  1. It is permissable to talk to other students about your strategy for solving the problems assigned in labs. However, any code and any written material you submit must be written exclusively by you or provided by Professor Parker. Note that the word "exclusively" means that you may not use code written by anyone else, including but not limited to former or current students, or various sources off the internet. Failure to follow this guideline is considered cheating.

  2. It is not permissable to give code or written material that solves or partially solves a lab assignment to another student. Doing so is considered cheating. If you leave your directories or files publicly readable, we will consider that to be evidence that you have voluntarily given your code or written material to other students. Therefore you should read protect all directories and files associated with CS302. If you have a directory named cs302 then you can read and write protect it using the following command:
    	UNIX> chmod 0700 ~/cs302
    	

  3. Cheating will be dealt with harshly. At best you will receive a 0. At worst you will be referred to the office of student affairs for academic misconduct.


Late Labs

You are allowed one late lab without penalty. Notify TA Charles Phillips (cphillip at cs.utk.edu) before the lab deadline that you plan to take your late lab. You will have one week from the due date to complete the lab. After your first late lab all subsequent late labs will receive a grade of zero, with no exceptions. The reason for this policy is that I want you to hand in whatever you have completed with a lab and move on to the next one. In the past when I have permitted late labs with a per day penalty students have fallen hopelessly behind trying to complete labs and have ended up with extremely low lab averages.

The one late lab policy makes it imperative that you do not procrastinate and start your lab a day or two before the deadline. I will not look kindly upon excuses that the computers in the labs crashed a couple hours before the deadline. If you plan your time wisely you will have your lab mostly complete a day before the lab is due.


Commenting Your Code

You will be graded on commenting. Something like 15%. You should comment your code by blocks of comments at the beginning of your files, and before subroutines. Variables should be commented inline. You may also want to comment large blocks of code. You should not comment with a ``running commentary'' to the right of your code, because that is often useless, hard to maintain, and disconcerting. I have seen comments like the following:
  if (i == 0) {               /* If i equals zero */
    return;                   /* then return */
  } else {                    /* otherwise */
    exit(1);                  /* exit with a value of one */
  }
The above is an extreme example, but don't let it happen to you.

Here's an example of what I would consider a well documented program:

 
#include < stdio.h >

/* sumnsquared.c
   Author:  Ima Smart
   Date:    August 23, 1998

   This program prompts for and reads a value n from standard
   input, and then calculates and prints the sum of squares
   from one to n.  It uses a for loop instead of using the 
   closed form expression.
   */


main()
{
  int n;                   /* The value */
  int sum;                 /* The running sum of squares */
  int i;                   /* An induction variable */

  /* Prompt for and read in a value of n */

  printf("Enter a value n: ");
  fflush(stdout);
  if (scanf("%d", &n) != 1) {
    exit(1);
  }
  
  /* Calculate sum for each value of i from one to n */

  sum = 0;
  for (i = 1; i <= n; i++) sum += (i*i);

  /* Print the final summation */

  printf("%d\n", sum);
}