fastest sorted list type?
- From: "colin" <colin.rowe1@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 13 Jan 2008 00:43:37 GMT
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 =^.^=
.
- Follow-Ups:
- Re: fastest sorted list type?
- From: Arne Vajhøj
- Re: fastest sorted list type?
- From: Peter Duniho
- Re: fastest sorted list type?
- Prev by Date: Re: Services..
- Next by Date: Re: fastest sorted list type?
- Previous by thread: Re: How does Assert determine equality?
- Next by thread: Re: fastest sorted list type?
- Index(es):
Relevant Pages
|