Pergunta de entrevista da empresa J.P. Morgan

Which is more efficient for searching, linked list or array?

Respostas da entrevista

Sigiloso

23 de ago. de 2015

I said array, because we can jump directly to a particular index.

3

Sigiloso

12 de set. de 2016

if array is sorted then using binary search, it will take O(log n) time. I think arrays can perform better in sorted case. If unsorted linked list and array will do it in O(n) time.

1

Sigiloso

14 de nov. de 2017

array - cache friendly

Sigiloso

28 de abr. de 2016

Searching in array and linked list is both O(n) because you need to go thought each element or node to find the data your looking for.

1