I have a procedure that generates N x M values sequentially. I want to
store the N largest ones and discard the others. Obviously I can store
all the values in a vector, sort it when it is full and then choose the
top N values. Is there a more efficient way using a data structure that
just
Wouldn't a heap be ideal for this ?
On Mon, Jul 11, 2011 at 3:35 PM, John Reid j.r...@mail.cryst.bbk.ac.ukwrote:
I have a procedure that generates N x M values sequentially. I want to
store the N largest ones and discard the others. Obviously I can store all
the values in a vector, sort it
Similar to selection searching problem.
On Mon, Jul 11, 2011 at 4:37 PM, abhijith reddy abhijith200...@gmail.comwrote:
Wouldn't a heap be ideal for this ?
On Mon, Jul 11, 2011 at 3:35 PM, John Reid j.r...@mail.cryst.bbk.ac.ukwrote:
I have a procedure that generates N x M values