CSC 103 Assignment 1:
Lists, Stacks, and Queues




Program Specification

Write a Java program that implements the methods of a GeneralList class. Precise specifications of the class and its methods are provided in the class documentation at

         http://latte.java.calpoly.edu/~gfisher/classes/103/assignments/1/javadoc

Your job for this assignment is to copy the unimplemented template file for the GeneralList class and fill in the methods. The template file for you copy is

         http://latte.java.calpoly.edu/~gfisher/classes/103/assignments/1/GeneralList.java

Program Implementation Requirements

Your implementation of GeneralList must use a linked list data representation of some form. Specific implementation details are up to you, as long as your program meets the performance requirements given below. You must write your own linked-list implementation, without using the JFC LinkedList class or any similar Java library class.

Program Performance Requirements

Your implementation must meet the following performance requirements:

  1. The methods putFirst, putLast, getFirst, getLast, removeFirst, and removeLast must each operate in O(1) time.
  2. The methods put, get, set, and remove must operate in O(N/2) time, for N = the length of the list.
  3. On a sorted list with no duplicate elements, the elementOf and findIndex methods must operate in O(log N) time; two elements e1 and e2 are considered duplicates if e1.equals(e2).
  4. The sort method must operate in O(N2) time.

Program Testing

A simple demonstrational testing program is provided at

         http://latte.java.calpoly.edu/~gfisher/classes/103/assignments/1/GeneralListTest.java

This test program provided is for demonstration purposes. When you hand in your solution to assignment 1 it will be subject to more rigorous testing. It is your job to ensure that your implementation works properly for any possible test data.

Reading Resources

Chapter 3 of the text book and the week 2 lecture notes describe the linked- list implementation techniques you'll need for this assignment. A discussion of the O-notation used to define the performance requirements is in Chapter 2 of the book and lecture notes week 1.

Grading Criteria

Your program will be graded with a raw score of 100 points, broken down as follows:

Program Feature Points
Correct compilation 10
Correct output 40
Correct performance 25
Correct documentation 25
  class comment     8
  method comments     12
  data field comments     2
  in-line code comments     3
For assignment 1, the class and method comments are provided for you in the template, so you get these points for free for this assignment. Note that in terms of the grading scheme presented in the course syllabus, this point breakdown means that a completely undocumented program is worth at best a "C" grade.

Further specific details of program documentation conventions are covered in the handout on program design and implementation

Program Turnin Procedure

For this and all future programming assignments, you will use the UNIX turnin command. Details of program turnin will be be covered in the second week of lab.



index | lectures | labs | handouts | assignments | solutions | doc | grades | help