CDWordArray and sort
-
hi, I have a CDWordArray with many items. I need to sort it, in the quickest possible way. Please tell me how to do it. the code I use now is, void CSortableDWordArray::Sort(DWORDCOMPAREFN pfnCompare) { DWORD * prgdw = GetData(); qsort(prgdw,GetSize(),sizeof(DWORD),(GENERICCOMPAREFN)pfnCompare); } It does not seem to be very fast. regards hari Hari Krishnan
-
hi, I have a CDWordArray with many items. I need to sort it, in the quickest possible way. Please tell me how to do it. the code I use now is, void CSortableDWordArray::Sort(DWORDCOMPAREFN pfnCompare) { DWORD * prgdw = GetData(); qsort(prgdw,GetSize(),sizeof(DWORD),(GENERICCOMPAREFN)pfnCompare); } It does not seem to be very fast. regards hari Hari Krishnan
how many items do you have in your array? Bryce --- Publitor, making Pubmed easy. http://www.sohocode.com/publitor
-
how many items do you have in your array? Bryce --- Publitor, making Pubmed easy. http://www.sohocode.com/publitor
thanks, About 10,000 to 20,000. Another question, how about adding the items sorted while it is being added ? Which is faster. Also, how can i use heapsort ? regards hari Hari Krishnan
-
thanks, About 10,000 to 20,000. Another question, how about adding the items sorted while it is being added ? Which is faster. Also, how can i use heapsort ? regards hari Hari Krishnan
-
thanks, About 10,000 to 20,000. Another question, how about adding the items sorted while it is being added ? Which is faster. Also, how can i use heapsort ? regards hari Hari Krishnan
std::set
from the STL does exactly this: hold a sorted collection of objects. Depending on the access pattern you use with your collection, it may or may not be what you want.
Who is 'General Failure'? And why is he reading my harddisk?!?
-
thanks, About 10,000 to 20,000. Another question, how about adding the items sorted while it is being added ? Which is faster. Also, how can i use heapsort ? regards hari Hari Krishnan
ok 10k -> 20k how long does it take to sort and how fast is your PC etc Bryce --- Publitor, making Pubmed easy. http://www.sohocode.com/publitor