LinkedList vs. DynamicArray
Solution
get is on DynamicArray, since it computes the slot directly, and on LinkedList, since it has to traverse from an end. add to the end is amortized on DynamicArray, since most adds are cheap but an occasional grow copies every element, and every time on LinkedList, since it allocates and links one node without ever copying. remove(index) is on both, but for different reasons: the array shifts every element after the gap to close it, while the linked list’s cost is the traversal to find the node. Once found, unlinking it is .
Solution
DynamicArray. Its get and set are , while LinkedList’s are , and the program’s access pattern is exactly indexed reads and writes.
Solution
With a direct reference to the node, the linked list skips the traversal entirely. Unlinking is just two reference reassignments, regardless of the list’s length. The array has no equivalent shortcut: even given the position directly, it still has to shift every element after the removed one to close the gap, so it stays .