Pergunta de entrevista da empresa Lookout

Explain how the following two data structures work, and their pros and cons. 1) Hash table 2) Linked List (Unordered) bonus question (ugh): Why would you ever use a Unordered Linked List for storage of items?

Respostas da entrevista

Sigiloso

22 de mai. de 2013

Hash table: O(1) access, insert Linked List:O(n) access, O(1) insert

Sigiloso

15 de abr. de 2015

As for the bonus question: If you want to keep multiple instances of the same object then HashTable won't do - two identical objects will most likely have the same key and therefore the second instance will override the first in its HashTable location.