Stable topN?

Peter Alexander via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 23 21:40:47 PDT 2014


On Monday, 23 June 2014 at 22:47:20 UTC, Xinok wrote:
> What do you all think? Do you agree with my definition of 
> stable topN? Do you know of a better algorithm/approach for 
> implementing this function?

I agree with your definition, and can't think of a better
algorithm, but wouldn't a stable sort have the same effect as
your algorithm? Both are O(n lg(n)) time and O(n) space.


More information about the Digitalmars-d mailing list