Amazon Interview Question

When do you use an array versus a linked list?

Interview Answers

Anonymous

Feb 19, 2012

Arrays are fixed in size. While linked list is dynamic. So when we don't know the size of the content in advance then we should use Linked List.

Anonymous

Mar 22, 2012

arrays also support indexed access to any element in O(1) time. LinkedLists would be O(n). LinkedLists work well if you need FIFO or LIFO behavior. Arrays take a little more bookkeeping to support these ops.