topN using a heap

Ivan Kazmenko via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 16 14:27:44 PST 2016


On Saturday, 16 January 2016 at 15:25:50 UTC, Andrei Alexandrescu 
wrote:
> 3. At the end, swap the largest in the heap with the 10th and 
> you're done!

And why this?  Do we additionally require the k-th element to 
arrive exactly on k-th place?



More information about the Digitalmars-d mailing list