PrepAway - Latest Free Exam Questions & Answers

Which class should you choose?

You need to select a class that is optimized for key-based item retrieval from both small and large collections.
Which class should you choose?

PrepAway - Latest Free Exam Questions & Answers

A.
OrderedDictionary class

B.
HybridDictionary class

C.
ListDictionary class

D.
Hashtable class

Explanation:
A HybridDictionary is implemented as a ListDictionary for small collections and a Hashtable for large collections. Hence it provides very efficient storage for both small and large collections.
OrderedDictionary supports sorting based on the key. It has similar disadvantages for small collections to Hashtable on which it is based.
ListDictionary is ideal for small collections because it is implemented as a light-weight linked list. Performance will suffer for large collections.
HashTable is ideal for large collections, for small collections the overheads of such a sophisticated data structure do not compensate for the benefits.

One Comment on “Which class should you choose?


Leave a Reply