Two Lists, Side by Side

We now have two classes with the same operations implemented in different ways. That means we can put the operations side by side and compare the costs.

Here is the time complexity of each operation:

Operation DynamicArray LinkedList
add (to end) amortized
get
set
size
indexOf
contains
remove(index)
remove(value)

The array is faster on the get and set operations. The linked list is faster on the add operation, but only when the array has to resize.