topN using a heap

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 18 13:01:40 PST 2016


On 01/18/2016 01:00 PM, Ivan Kazmenko wrote:
>
> The old version (2.070.0-b2) could not be tricked with it, does it use
> random?

Yes, it selected the pivot uniformly at random using the global RNG. 
(This is also why the documentation says topN is O(n) in expectation.)


More information about the Digitalmars-d mailing list