This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment EC #1 (Assignment #8)
November 14, 2001
Due: Monday, November 19 at 11:59 p.m.
Assignment: ArrayList extends QueueArray revisited. Submit as Assignment #8.
Total point value of assignment: 50 points
Not accepted late.
This assignment is to be done INDIVIDUALLY.
Assignment: Partial credit is not available for this extra credit.
Your program must meet requirements given below and must run without
error with the test driver sent to you by email.
The defaultSize of the array is 10.
The method "private void resize()" is to be called only when
the array becomes full, that is, when isFull() returns true.
Note the change of the method from public to private. The
complexity of resize() is O(N), where N is the number of items
in the list.
The following methods must have time complexity O(1) when
the method isFull() returns false. (Use the isFull() method
in the QueueArray class.)
public void add ( Object value )
public void addToHead ( Object value )
public addToTail ( Object value )
The following methods must have time complexity O(1):
public void addToTail ( Object value )
public Object peek ( )
public Object tailPeek ( )
public Object removeFromHead ( )
public Object removeFromTail ( )
public int size()
public boolean isEmpty()
public void clear()
The following methods have time complexity O(N).
public boolean contains ( Object value )
public Object remove ( Object value )
public String toString ( )
public boolean equals ( Object other )
Incorrect time complexity for any method disqualifies the submission
from extra credit.
It is suggested that you modify your original submission of Assignment
#6 rather than include the iterator. However, presence of the Iterator
will not disquality the entry and the Iterator will not be tested.
Grading Rubric:
Required that all methods are of correct complexity and program runs
without error on test code provided and with array length as specified
and calls to resize() only as specified. (No partial credit)
Also, the ONLY method that copies the entire array is resize().
The remove method should only shift a section of the list, either
from the removePosition toward the head or from the removePosition
toward the end (tail) of the list. The remove method should not
make a copy of the entire list.
Other requirements:
The first operation of your main program must be to print "CPSC 210", your name, the assignment number, and a brief description of the assignment.
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Submit your program using the handin command as Assignment #8. There is a link to
the handin description on the CPSC 210 lab page (www.cs.clemson.edu/~lab210).