Singly Linked List (written by Chase Gray)
Please note that you will have TWO lab periods to complete this lab assignment! Wednesday, Feb 20 and Wednesday, Feb 27.Concepts Covered: Building a list data structure using a singly linked list.
Due: At the end of lab on Wednesday, Feb 27
Files you need: SList.java, SListNode.java, List.java
Turn in: SList.java, SListNode.java, SListTester.java
Requirements: You are again given the List interface. Your job is to implement the List interface via a class that uses a singly linked list data structure to store the data. Write the class to implement the operations in the List interface using a singly linked list as described in step 1. Note that there are two classes to implement: the link-node class, SListNode and the actual list, SList. The class SListNode should have some primitive methods that can be used to make the implementation of SList() easier. All the methods in the List interface (including isFull())will need to be implemented in the class SList. Each element in the list should be represented by an SListNode object. Each of these nodes will link to the next node in the list. There is no previous pointer in the nodes, since this is only a singly linked list. Make sure you handle all the cases that might occur for each method. For example the insert test cases should include inserting the first element into an empty list, inserting an element at the beginning of the list, inserting an element into the middle of the list, and inserting an element at the end of the list; note that with a linked list implementation the list is never “full”. Your method’s code should be able to handle each of these situations correctly. You are also required to write a program that tests your SList class to make sure it is working properly. You should write the code for these two programs simultaneously (i.e. write a method in the SList class, and then write code that tests that it is working properly in the SListTester program). Your tester can be very similar to your ListArray tester because we are using the same List interface. So if you write your test assuming the object you are testing implements the List interface you should be able to write generic tests that would work for either implementation.
After implementing the SList please complete in-lab excercises 1, 2, and 3.
Please note that there are slight differences in the code that is included here and the code that is in your lab manual. Implement the methods as they are described here!
Do the following in order: