Which .NET collection offers fast average-case lookup of values by key?
Correct answer
D. Dictionary<TKey, TValue>
15 views
D. Dictionary<TKey, TValue>
15 views
Dictionary<TKey, TValue> is a hash table, giving O(1) average lookups by key. Searching a List of key-value pairs or a LinkedList is O(n).
Asked in: NTS, PPSC, Technical Interviews
Not sure why the answer is D? Ask here and get an explanation.