T
Tony Johansson
Hi!
If we have the text at the bottom as a base for answering the question at
the bottom which answer is most appropriate ?
The choice is between Generic SortedDictionary and Generic SortedList.
So the question is which one is fastest ?
Here is some docs from MSDN but according to this I can't find which one of
Generic SortedDictionary and
Generic SortedList is the best choice.
The SortedDictionary<(Of <(TKey, TValue>)>) generic class is a binary search
tree with O(log n) retrieval, where n is the number of elements in the
dictionary. In this respect, it is similar to the SortedList<(Of <(TKey,
TValue>)>) generic class. The two classes have similar object models, and
both have O(log n) retrieval. Where the two classes differ is in memory use
and speed of insertion and removal:
SortedList<(Of <(TKey, TValue>)>) uses less memory than SortedDictionary<(Of
<(TKey, TValue>)>).
SortedDictionary<(Of <(TKey, TValue>)>) has faster insertion and removal
operations for unsorted data: O(log n) as opposed to O(n) for SortedList<(Of
<(TKey, TValue>)>).
If the list is populated all at once from sorted data, SortedList<(Of
<(TKey, TValue>)>) is faster than SortedDictionary<(Of <(TKey, TValue>)>).I
have loker
"You are using Visual Studio 2005 to create a preferred customer management
application. On the customer selection screen, the user enters the customer's
unique customer ID to pull up that customer's information. The customer
information is stored in an XML file as a serialized XML representation of a
customer objects. It is important that the customer data be displayed as
rapidly as possible. Also there is a reporting page; the report generated
from this page is going to display all customers, sorted by customer ID in
ascending order. It is extremely important that this report be generated as
rapidly as possible. What type of collection will you use to implement this
logic?"
Generic SortedDictionary
Generic Dictionary
Generic SortedList
Non-generic StringDictionary
//Tony
If we have the text at the bottom as a base for answering the question at
the bottom which answer is most appropriate ?
The choice is between Generic SortedDictionary and Generic SortedList.
So the question is which one is fastest ?
Here is some docs from MSDN but according to this I can't find which one of
Generic SortedDictionary and
Generic SortedList is the best choice.
The SortedDictionary<(Of <(TKey, TValue>)>) generic class is a binary search
tree with O(log n) retrieval, where n is the number of elements in the
dictionary. In this respect, it is similar to the SortedList<(Of <(TKey,
TValue>)>) generic class. The two classes have similar object models, and
both have O(log n) retrieval. Where the two classes differ is in memory use
and speed of insertion and removal:
SortedList<(Of <(TKey, TValue>)>) uses less memory than SortedDictionary<(Of
<(TKey, TValue>)>).
SortedDictionary<(Of <(TKey, TValue>)>) has faster insertion and removal
operations for unsorted data: O(log n) as opposed to O(n) for SortedList<(Of
<(TKey, TValue>)>).
If the list is populated all at once from sorted data, SortedList<(Of
<(TKey, TValue>)>) is faster than SortedDictionary<(Of <(TKey, TValue>)>).I
have loker
"You are using Visual Studio 2005 to create a preferred customer management
application. On the customer selection screen, the user enters the customer's
unique customer ID to pull up that customer's information. The customer
information is stored in an XML file as a serialized XML representation of a
customer objects. It is important that the customer data be displayed as
rapidly as possible. Also there is a reporting page; the report generated
from this page is going to display all customers, sorted by customer ID in
ascending order. It is extremely important that this report be generated as
rapidly as possible. What type of collection will you use to implement this
logic?"
Generic SortedDictionary
Generic Dictionary
Generic SortedList
Non-generic StringDictionary
//Tony