Boost logo

Boost Users :

Subject: Re: [Boost-users] Finding the n smallest items in a list
From: Ray Burkholder (ray_at_[hidden])
Date: 2009-02-04 09:30:13


stl has a minheap algorithm, I believe.

> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-
> bounces_at_[hidden]] On Behalf Of Ruediger Berlich
> Sent: Wednesday, February 04, 2009 07:59
> To: boost-users_at_[hidden]
> Subject: [Boost-users] Finding the n smallest items in a list
>
> 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 ?
>
> Best Regards,
> Ruediger
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
> --
> Scanned for viruses and dangerous content at
> http://www.oneunified.net and is believed to be clean.

-- 
Scanned for viruses and dangerous content at 
http://www.oneunified.net and is believed to be clean.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net