i have a list of ids(about 7000)..... 31 ids belongs to group1,group2,group3 and so on....
i want to be able to search in which group an id is.....
what's the best structure to use to store the groups and ids??
Printable View
i have a list of ids(about 7000)..... 31 ids belongs to group1,group2,group3 and so on....
i want to be able to search in which group an id is.....
what's the best structure to use to store the groups and ids??
You have many different data structures to choose from in .NET 2.0 and I believe the use of generics performs the quickest. Here are some facts I found on some of the available data structures in 2.0.
- SortedList<T> - Shell Sort
GeneralTree<T> - Heap Sort
Graph<T> - Insertion Sort
Heap<T> - Merge Sort
Matrix - Odd-Even Transport Sort
PascalSet - Quick Sort
PriorityQueue<T> -Selection Sort
SkipList<TKey, TValue> -Shaker Sort
SortedList<T> - Shell Sort
Each sorting algorithm has a different runtime and different constraints that makes each perform better and worse.
i am using a list for each group which i think is not really a good idea... will try the structures u suggested but dun really know how to use them....
how can i use sorted list so that i enter the ids as key and value as the group id or name?? i use sortedl.add(id,group_id) and used "sortedl.item(id)" to retrieve the group_id but i get this error
"Failed to compare two elements in the array"
ok figured what was wrong!!! it's very fast now thanks!!!