Class ListPutFirstTest
java.lang.Object
|
+--ListPutFirstTest
- public class ListPutFirstTest
- extends java.lang.Object
Class ListPutFirstTest runs test cases on the putFirst methods of
the ListAsArray and ListAsLinkedList classes. An empirical analysis
is performed on the actual running times of ListAsArray.putFirst
versus ListAsLinkedList.putFirst. The putFirst methods
are invoked to create lists of sizes of 1000 to 30000 elements, in
increments of 1000.
Here are plots of the results of a typical comparison run:
Questions:
-
What kind of graphs do these look like?
-
What are the analytic running time functions for these tests?
Method Summary |
protected static long |
doArrayPuts(int n)
Call ListAsArray.putFirst n times. |
protected static long |
doLinkedPuts(int n)
Call ListAsLinkedList.putFirst n times. |
static void |
main(java.lang.String[] args)
Construct ListAsArray and ListAsLinkedList classes and call their
putFirst methods on lists of sizes 1000 to 30000 elements, in increments
of 100. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
arrayList
protected static ListAsArray arrayList
- Array version of list
linkedList
protected static ListAsLinkedList linkedList
- Linked version of list
ListPutFirstTest
public ListPutFirstTest()
main
public static void main(java.lang.String[] args)
- Construct ListAsArray and ListAsLinkedList classes and call their
putFirst methods on lists of sizes 1000 to 30000 elements, in increments
of 100. Output the results to stdout.
doArrayPuts
protected static long doArrayPuts(int n)
- Call ListAsArray.putFirst n times. Return the amount of time (in
milliseconds) that it takes to do it.
doLinkedPuts
protected static long doLinkedPuts(int n)
- Call ListAsLinkedList.putFirst n times. Return the amount of time (in
milliseconds) that it takes to do it.