Pergunta de entrevista da empresa Yelp

If memory is limited, which data structure is better: hashtable or binary tree?

Respostas da entrevista

Sigiloso

27 de dez. de 2010

binary tree is better if memory is limited...

2

Sigiloso

7 de out. de 2011

To add more to the above answer. Binary trees use memory in proportion to the data that is to be stored - the data and links. For a hash table, if the hash function has a huge range, you will have to allocate an array that has an entry for each number in the range. You could potentially store far lesser number of elements than the range.

1