$29
This assignment makes use of the files contained in this zip file.
This assignment is based on Programming Project 9 on page 249 of our textbook (but you don't need to follow any of the instructions given in that project).
In the zip file hw3.zip there is a Java file, IntLinkedSeq.java and its Javadoc html file, IntLinkedSeq.html. In this assignment you will complete the source file IntLinkedSeq.java so that it implements the interface specified in IntLinkedSeq.html.
The IntLinkedSeq abstract data type is similar to the IntLinkedBag abstract data type, so some of the implementation of IntLinkedSeq is similar to the equivalent implementation of IntLinkedBag. The main difference between the two data types is that a sequence "remembers" the order of all its elements, but a bag does not maintain any information about the order of its elements. Also, the sequence interface contains a few new methods that are not equivalent to any method from the bag interface.
One big difference between your implementation of the IntLinkedSeq interface and the textbook's implementation of the IntLinkedBag interface is that in this assignment you must use a simpler definition of the IntNode interface. In the zip file hw3.zip there is a Java file, IntNode.java that implements a different version of IntNode from the one in the book. The version of IntNode in the zip file is designed to separate the responsibilities of a node object from the responsibilities of the data structure being built with the nodes. Do not make any changes to the file IntNode.java.
Probably the hardest part of this assignment is the two methods addAfter() and addBefore(). There are several cases to consider within each method - does the sequence have a "current" element, is the sequence empty, are you positioned at the beginning or the end of the sequence? Be sure to test these two methods carefully (and draw pictures!).
While you are doing this assignment, try to "use the interface to implement the interface". That is, try to implement methods in the interface by using more basic, or fundamental, methods from the interface. You need to think about which methods are the most basic. Then implement those first, and then start building other methods (as much as possible) from the basic ones.
In the zip file hw3.zip there are several Java files, TestIntLinkedSeq_ver*.java, that you can use to test your implementation of the IntLinkedSeq public interface. The first file, TestIntLinkedSeq_ver1.java, tests the most important methods.
Turn in a zip file called CS275Hw3Surname.zip (where Surname is your last name) containing your version of IntLinkedSeq.java.