4 Feb
2009
4 Feb
'09
2:30 p.m.
Hi there,
I'm searching for a method to find the n smallest numbers in a list of m >> n numbers. The n numbers need to be sorted. m will usually be in the range of 100-1000, n will be 5 or less. So far I'm simply sorting the entire vector, which I assume is not very efficient, as the other m-n items in the container can remain unsorted. Is there a function in Boost that can help me in this situation ?
This sounds like a job for std::partial_sort. -- -- Marshall Marshall Clow Idio Software mailto:marshall@idio.com It is by caffeine alone I set my mind in motion. It is by the beans of Java that thoughts acquire speed, the hands acquire shaking, the shaking becomes a warning. It is by caffeine alone I set my mind in motion.