In this assignment you will be implementing the List Abstract Data Type (ADT) using two different implementations:
In addition, you will also be writing a driver to test your List implementations and you will be measuring the test times and memory usage of each test case.
You will also be using the TestTimes class that you created for Homework 1.
Finally, you will be analysing and comparing the performance of the test cases on both the Array Based List and the Linked List implementations.
You will copy the TestTimes class that you created in Homework 1 to the
project you are using for this assignment. Please note that you will also have to re-submit
TestTimes.java to zyBooks in the TestTimes zyLab
You will write the ArrayBasedList.java class which will implement the
List Interface.
The interface may be downloaded from
here
.
You will write the LinkedList.java class which will implement the
List Interface.
The interface may be downloaded from
here
.
Your will write the LinkedListNode. Please see the
Linked List Node Documentation
for all the methods you will need.
You will write the ListDriver.java class which will implement the
ListDriver Interface.
The interface may be downloaded from
here
.
Please note that, in addition to implementing the ListDriverInterface, you are also required to write
your own public static main(String[] args) method in ListDriver.java that performs all of
the required tests as specified below.
You will test two list implementations with different tests. You will run all tests on both implementations
of the ListInterface. The ListDriverInterface includes the definitions of two enums:
ListInterface.
ListInterface.
All the elements being added and removed from the lists must be instances of the
Integer class.
This enum defines all the tests that you will be performing. The tests are:
ListDriverInterface.TestType.AddSortedOdd:
ListDriverInterface.TestType.AddSortedEven:
ListDriverInterface.TestType.AddAll:
ListDriverInterface.TestType.AddAllAtIndexZero:
ListDriverInterface.TestType.RemoveAllEven:
ListDriverInterface.TestType.RemoveAllOdd:
Please note that, in addition to implementing the ListDriverInterface, you are also required to write
your own public static main(String[] args) method in ListDriver.java.
Your main() method will have to call the runTestCase() method for each of test cases
listed above a total of ten times for each test case:
For each call to the runTestCase() method your main() method will print out a table with the
following output for the Array Based List and the Linked List implementations:
Please note that the test times and the average are in Seconds and the memory usage is in Mega Bytes. You will need to make the necessary conversions.
For each call to the runTestCase() method your main() method will print out a table with the following output for the Array Based List and the Linked List implementations:
Running test = Test Case Name
Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7 Run 8 Run 9 Run 10 Average Memory Usage
Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Mega Bytes
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------------
ArrayBasedList
LinkedList
Running test = AddSortedOdd
Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7 Run 8 Run 9 Run 10 Average Memory Usage
Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Mega Bytes
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------------
ArrayBasedList 0.02307 0.01399 0.01030 0.01123 0.01072 0.01021 0.00992 0.01120 0.01037 0.01075 0.01218 7.73121
LinkedList 0.04180 0.03222 0.02897 0.02790 0.02673 0.02876 0.02632 0.02728 0.03080 0.02582 0.02966 2.92120
Running test = AddSortedEven
Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7 Run 8 Run 9 Run 10 Average Memory Usage
Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Mega Bytes
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------------
ArrayBasedList 0.05055 0.03056 0.03102 0.02940 0.02806 0.03170 0.03088 0.02807 0.02978 0.02852 0.03186 24.36255
LinkedList 0.09666 0.08369 0.08281 0.08503 0.08833 0.08474 0.09145 0.08415 0.09071 0.07999 0.08675 5.47630
Running test = AddAll
Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7 Run 8 Run 9 Run 10 Average Memory Usage
Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Mega Bytes
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------------
ArrayBasedList 0.00099 0.00077 0.00053 0.00056 0.00059 0.00066 0.00064 0.00061 0.00060 0.00062 0.00066 21.80157
LinkedList 0.00035 0.00010 0.00010 0.00010 0.00010 0.00010 0.00010 0.00010 0.00010 0.00010 0.00012 5.47639
Running test = AddAllAtIndexZero
Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7 Run 8 Run 9 Run 10 Average Memory Usage
Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Mega Bytes
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------------
ArrayBasedList 0.03448 0.03356 0.03297 0.03371 0.03378 0.03390 0.03310 0.03369 0.03337 0.03381 0.03364 21.80177
LinkedList 0.00106 0.00027 0.00026 0.00022 0.00022 0.00022 0.00016 0.00098 0.00025 0.00023 0.00039 4.19656
Running test = RemoveAllEven
Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7 Run 8 Run 9 Run 10 Average Memory Usage
Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Mega Bytes
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------------
ArrayBasedList 0.02156 0.01578 0.01456 0.01461 0.01493 0.01546 0.01498 0.01487 0.01544 0.01445 0.01566 23.08179
LinkedList 0.03528 0.03296 0.02743 0.02793 0.03115 0.02535 0.02531 0.03454 0.03125 0.02417 0.02954 4.19664
Running test = RemoveAllOdd
Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7 Run 8 Run 9 Run 10 Average Memory Usage
Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Seconds Mega Bytes
------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------------
ArrayBasedList 0.00825 0.00819 0.00812 0.00753 0.00744 0.00779 0.00768 0.00736 0.00714 0.00748 0.00770 21.80184
LinkedList 0.04604 0.04306 0.04110 0.04615 0.04815 0.04794 0.03827 0.04334 0.04164 0.04790 0.04436 4.19664
Using the tables you created by running ListDriver.main(), copy your results and your graphs into a Microsoft Word document and answer the following questions using 1-3 complete sentences for each question:
Please submit the completed assignment in your zyBooks , in the Homework 3 Chapter.
Please submit your analysis on Blackboard as a typed Microsoft Word file (.docx). No other forms of submission will be accepted. Please include your graphs in the same file as your analysis.