Pergunta de entrevista da empresa Tripadvisor

Other than an array, what data structure has O(1) insertion and O(1) search?

Respostas da entrevista

Sigiloso

14 de out. de 2011

The array does not have O(1) search.... It takes O(n) if it's unsorted, O(log n) if sorted, but if it is sorted, then insertion is no longer O(1)

2

Sigiloso

7 de out. de 2011

A hash table

1