Results 1 to 5 of 5

Thread: [2005] best structure for fastest search

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    128

    [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??

  2. #2
    Fanatic Member Jumpercables's Avatar
    Join Date
    Jul 2005
    Location
    Colorado
    Posts
    592

    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.

    C# - .NET 1.1 / .NET 2.0

    "Take everything I say with a grain of salt, sometimes I'm right, sometimes I'm wrong but in the end we've both learned something."
    _____________________
    Regular Expressions Library
    Connection String
    API Functions
    Database FAQ & Tutorial

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    128

    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....

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    128

    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"

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Jan 2007
    Posts
    128

    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
  •  



Click Here to Expand Forum to Full Width