Sollicitatievraag bij Amazon

When do you use an array versus a linked list?

Antwoorden op sollicitatievragen

Anoniem

19 feb 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.

Anoniem

22 mrt 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.