If memory is limited, which data structure is better: hashtable or binary tree?
Interview Answers
Anonymous
27 Dec 2010
binary tree is better if memory is limited...
2
Anonymous
7 Oct 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.