fastest sorted list type?



Hi,
I have an array of structs wich contain amonsgst other things a Length of
type float,
I wish to make a sorted index array based on the length,
wich does have duplicates.

I initialy added all the indices to a list<int> and then sorted the list
using a comparar wich took the index and looked up struct in the array and
compared the length.

This was quite slow, so I thought id write a routine wich used binary search
to add indeices to the list in order,
While this called the compare routine far fewer times it did in fact take a
lot longer.

So i tried SortedList but unfortunatly this doesnt allow duplicate keys.

was I right in my first attempt or is there a better way ?
why is there two types of comparer functionality,
one of wich accepts a static member function,
the other a member function wich cant be static yet it still
takes two parameters, whats the this pointer used for in such cases ?

sort uses either, but binary search uses the later, would this make it
slower ?

the list contains over 2 million entries, wich is why i used an array of
structs as a list of classes would require lots of allocations
....


thanks
Colin =^.^=


.



Relevant Pages

  • Re: PropertyDescriptor (rambling progress)
    ... I simply use a facade wich can handle anything via reflection even ... the Vector array, I assume this is doing its own create instance? ... array of library structs. ... but not when they are expanded in the property editor itself. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Is there a faster hi resolution timer for diy profiling
    ... in the build options theres optimise code wich makes a slight difference. ... I had to ask how to do 1 or 2 things so far only to be told you cant do ... wich is an array of structs, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: fastest way to change case of string
    ... using the same approach, swapping only the BSTR-Pointers. ... but couldn't find a fast way to write the array to a Recordset. ... There are no "RowPointers" in such a scenario, wich could be swapped ... wich acts as an additional layer of indirection. ...
    (microsoft.public.vb.general.discussion)
  • Re: Super slow table array formulas
    ... Wich is the table array. ... sheet one, but the range is literally r4:s12. ... "Don Guillett" wrote: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: fastest sorted list type?
    ... I wish to make a sorted index array based on the length, ... wich does have duplicates. ... using a comparar wich took the index and looked up struct in the array ... So i tried SortedList but unfortunatly this doesnt allow duplicate keys. ...
    (microsoft.public.dotnet.languages.csharp)