|
-
Jan 18th, 2007, 07:35 PM
#1
Thread Starter
Addicted Member
[2005] best structure for fastest search
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??
-
Jan 18th, 2007, 10:48 PM
#2
Fanatic Member
Re: [2005] best structure for fastest search
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.
-
Jan 19th, 2007, 01:38 AM
#3
Thread Starter
Addicted Member
Re: [2005] best structure for fastest search
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....
-
Jan 19th, 2007, 02:08 AM
#4
Thread Starter
Addicted Member
Re: [2005] best structure for fastest search
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"
-
Jan 19th, 2007, 02:39 AM
#5
Thread Starter
Addicted Member
Re: [2005] best structure for fastest search
ok figured what was wrong!!! it's very fast now thanks!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|