Amazon Interview Question

What is the difference between arrays and linked lists?

Interview Answer

Anonymous

Sep 28, 2011

Arrays have O(1) access.. You have to traverse a LL to get to an element. Easier to add a new element in LL (variable size). arrays are usually fixed length, if you try to realloc (it will copy all elements.. expensive!)